Skip to content

Commit defa3f9

Browse files
💚 Increase unit tests timeouts
1 parent 0872f26 commit defa3f9

File tree

1 file changed

+29
-25
lines changed

1 file changed

+29
-25
lines changed

src/lib/crypto.test.ts

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,38 +7,42 @@ import {
77
} from '$lib/crypto';
88
import { describe, it, expect } from 'vitest';
99

10-
describe('The crypto module', () => {
11-
const content = 'La barbe de la femme à Georges Moustaki';
10+
describe(
11+
'The crypto module',
12+
() => {
13+
const content = 'La barbe de la femme à Georges Moustaki';
1214

13-
it('generates keypairs', async () => {
14-
const keyPair = await generateKeyPair();
15-
expect(keyPair.privateKey).toBeDefined();
16-
expect(keyPair.publicKey).toBeDefined();
17-
});
15+
it('generates keypairs', async () => {
16+
const keyPair = await generateKeyPair();
17+
expect(keyPair.privateKey).toBeDefined();
18+
expect(keyPair.publicKey).toBeDefined();
19+
});
1820

19-
it('encrypts content that can be decrypted', async () => {
20-
const keyPair = await generateKeyPair();
21+
it('encrypts content that can be decrypted', async () => {
22+
const keyPair = await generateKeyPair();
2123

22-
const encryptedContent = await encryptContent(content, keyPair.publicKey);
24+
const encryptedContent = await encryptContent(content, keyPair.publicKey);
2325

24-
expect(encryptedContent).toBeDefined();
26+
expect(encryptedContent).toBeDefined();
2527

26-
const decryptedContent = await decryptContent(encryptedContent, keyPair.privateKey);
28+
const decryptedContent = await decryptContent(encryptedContent, keyPair.privateKey);
2729

28-
expect(decryptedContent).toBe(content);
29-
});
30+
expect(decryptedContent).toBe(content);
31+
});
3032

31-
it('exports and imports keypairs', async () => {
32-
const keyPair = await generateKeyPair();
33+
it('exports and imports keypairs', async () => {
34+
const keyPair = await generateKeyPair();
3335

34-
const exportedKeyPair = await keyPairToString(keyPair);
35-
expect(exportedKeyPair).toBeDefined();
36+
const exportedKeyPair = await keyPairToString(keyPair);
37+
expect(exportedKeyPair).toBeDefined();
3638

37-
const importedKeyPair = await stringToKeyPair(exportedKeyPair);
38-
expect(importedKeyPair).toBeDefined();
39+
const importedKeyPair = await stringToKeyPair(exportedKeyPair);
40+
expect(importedKeyPair).toBeDefined();
3941

40-
const encryptedContent = await encryptContent(content, keyPair.publicKey);
41-
const decryptedContent = await decryptContent(encryptedContent, importedKeyPair.privateKey);
42-
expect(decryptedContent).toBe(content);
43-
});
44-
});
42+
const encryptedContent = await encryptContent(content, keyPair.publicKey);
43+
const decryptedContent = await decryptContent(encryptedContent, importedKeyPair.privateKey);
44+
expect(decryptedContent).toBe(content);
45+
});
46+
},
47+
{ timeout: 10000 }
48+
);

0 commit comments

Comments
 (0)