Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandre-abrioux committed Nov 6, 2023
1 parent c9cd8e9 commit 9f79256
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions packages/utils/test/crypto/ec-utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,16 +162,14 @@ describe('Utils/EcUtils', () => {
).rejects.toThrowError('The encrypted data is not well formatted');
});

it('should be compatible with previous implementation of eccrypto', async () => {
const dataTypes = { native: eccryptoNativeData, browser: eccryptoBrowserData } as const;
for (const dataType in dataTypes) {
console.log(`testing ${dataType} type`);
const array = dataTypes[dataType as keyof typeof dataTypes];
for (const row of array) {
const { data, key, encrypted } = row;
const decrypted = await ecDecrypt(key, encrypted);
expect(decrypted).toBe(data);
}
it.each([
{ type: 'native', array: eccryptoNativeData },
{ type: 'browser', array: eccryptoBrowserData },
])('should be compatible with legacy $type implementation of eccrypto', async ({ array }) => {
for (const row of array) {
const { data, key, encrypted } = row;
const decrypted = await ecDecrypt(key, encrypted);
expect(decrypted).toBe(data);
}
});
});
Expand Down

0 comments on commit 9f79256

Please sign in to comment.