Skip to content

Commit c462267

Browse files
committed
Moved the beforeEach hook out of the Owned Records test suite
1 parent c7b6098 commit c462267

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

keeperapi/src/__tests__/vault.test.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,26 +34,26 @@ describe('Sync Down', () => {
3434
accountUid: platform.getRandomBytes(16)
3535
}
3636
})
37+
beforeEach(() => {
38+
storage = {
39+
get: jest.fn(),
40+
addDependencies: jest.fn(),
41+
delete: jest.fn(),
42+
removeDependencies: jest.fn(),
43+
put: jest.fn(),
44+
saveObject: jest.fn(),
45+
saveKeyBytes: jest.fn(),
46+
} as unknown as VaultStorage;
47+
mockSyncDownCommand = jest.fn()
48+
auth = {
49+
dataKey,
50+
eccPrivateKey: eccKeyPair.privateKey,
51+
eccPublicKey: eccKeyPair.publicKey,
52+
executeRest: mockSyncDownCommand,
53+
} as unknown as Auth;
54+
syncDownResponseBuilder = new SyncDownResponseBuilder();
55+
})
3756
describe('Owned Records', () => {
38-
beforeEach(() => {
39-
storage = {
40-
get: jest.fn(),
41-
addDependencies: jest.fn(),
42-
delete: jest.fn(),
43-
removeDependencies: jest.fn(),
44-
put: jest.fn(),
45-
saveObject: jest.fn(),
46-
saveKeyBytes: jest.fn(),
47-
} as unknown as VaultStorage;
48-
mockSyncDownCommand = jest.fn()
49-
auth = {
50-
dataKey,
51-
eccPrivateKey: eccKeyPair.privateKey,
52-
eccPublicKey: eccKeyPair.publicKey,
53-
executeRest: mockSyncDownCommand,
54-
} as unknown as Auth;
55-
syncDownResponseBuilder = new SyncDownResponseBuilder();
56-
})
5757
it('saves the record data when a new record is created by the user', async () => {
5858
const decryptedRecordKey = platform.getRandomBytes(32)
5959
const recordKey = await platform.aesGcmEncrypt(decryptedRecordKey, auth.dataKey!)

0 commit comments

Comments
 (0)