diff --git a/packages/keystores-browser/test/multi_contract_browser_keystore_common.test.ts b/packages/keystores-browser/test/multi_contract_browser_keystore_common.test.ts index 6289976899..15b6d7397b 100644 --- a/packages/keystores-browser/test/multi_contract_browser_keystore_common.test.ts +++ b/packages/keystores-browser/test/multi_contract_browser_keystore_common.test.ts @@ -9,42 +9,42 @@ const ACCOUNT_ID = 'accountid'; const CONTRACT_ID = 'contractid'; const KEYPAIR = new KeyPairEd25519('2wyRcSwSuHtRVmkMCGjPwnzZmQLeXLzLLyED1NDMt4BjnKgQL6tF85yBx6Jr26D2dUNeC716RBoTxntVHsegogYw'); -let ctx = { +const ctx = { keyStore: new MultiContractBrowserLocalStorageKeyStore(LocalStorageMemory) -} +}; beforeEach(async () => { - await ctx.keyStore.clear(); - await ctx.keyStore.setKey(NETWORK_ID, ACCOUNT_ID, KEYPAIR, CONTRACT_ID); + await ctx.keyStore.clear(); + await ctx.keyStore.setKey(NETWORK_ID, ACCOUNT_ID, KEYPAIR, CONTRACT_ID); }); test('Get not-existing account', async () => { - expect(await ctx.keyStore.getKey('somenetwork', 'someaccount', 'somecontract')).toBeNull(); + expect(await ctx.keyStore.getKey('somenetwork', 'someaccount', 'somecontract')).toBeNull(); }); test('Get account id from a network with single key', async () => { - const key = await ctx.keyStore.getKey(NETWORK_ID, ACCOUNT_ID, CONTRACT_ID); - expect(key).toEqual(KEYPAIR); + const key = await ctx.keyStore.getKey(NETWORK_ID, ACCOUNT_ID, CONTRACT_ID); + expect(key).toEqual(KEYPAIR); }); test('Get contracts', async () => { - const contracts = await ctx.keyStore.getContracts(NETWORK_ID, ACCOUNT_ID); - expect(contracts).toEqual([CONTRACT_ID]); + const contracts = await ctx.keyStore.getContracts(NETWORK_ID, ACCOUNT_ID); + expect(contracts).toEqual([CONTRACT_ID]); }); test('Add two contracts to account and retrieve them', async () => { - const networkId = 'network'; - const accountId = 'account'; - const contract1 = 'contract1'; - const contract2 = 'contract2'; - const key1Expected = KeyPairEd25519.fromRandom(); - const key2Expected = KeyPairEd25519.fromRandom(); - await ctx.keyStore.setKey(networkId, accountId, key1Expected, contract1); - await ctx.keyStore.setKey(networkId, accountId, key2Expected, contract2); - const key1 = await ctx.keyStore.getKey(networkId, accountId, contract1); - const key2 = await ctx.keyStore.getKey(networkId, accountId, contract2); - expect(key1).toEqual(key1Expected); - expect(key2).toEqual(key2Expected); - const contractIds = await ctx.keyStore.getContracts(networkId, accountId); - expect(contractIds).toEqual([contract1, contract2]); + const networkId = 'network'; + const accountId = 'account'; + const contract1 = 'contract1'; + const contract2 = 'contract2'; + const key1Expected = KeyPairEd25519.fromRandom(); + const key2Expected = KeyPairEd25519.fromRandom(); + await ctx.keyStore.setKey(networkId, accountId, key1Expected, contract1); + await ctx.keyStore.setKey(networkId, accountId, key2Expected, contract2); + const key1 = await ctx.keyStore.getKey(networkId, accountId, contract1); + const key2 = await ctx.keyStore.getKey(networkId, accountId, contract2); + expect(key1).toEqual(key1Expected); + expect(key2).toEqual(key2Expected); + const contractIds = await ctx.keyStore.getContracts(networkId, accountId); + expect(contractIds).toEqual([contract1, contract2]); }); diff --git a/packages/near-api-js/package.json b/packages/near-api-js/package.json index fbc5aa8654..f8d6d53d71 100644 --- a/packages/near-api-js/package.json +++ b/packages/near-api-js/package.json @@ -63,9 +63,6 @@ "test": "jest --passWithNoTests", "lint": "concurrently \"pnpm:lint:*(!fix) --no-error-on-unmatched-pattern\"", "lint:src": "eslint --ext .ts src", - "lint:fix": "concurrently \"pnpm:lint:*:fix\"", - "lint:src:fix": "eslint --ext .ts --fix src", - "lint:test:fix": "eslint --ext .js --fix test", "prefuzz": "pnpm build", "fuzz": "jsfuzz test/fuzz/borsh-roundtrip.js test/fuzz/corpus/", "clean": "pnpm rimraf lib",