优化
This commit is contained in:
17
server/lib/crypto/__tests__/des.spec.ts
Normal file
17
server/lib/crypto/__tests__/des.spec.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { desEncrypt, desDecrypt } from '../des';
|
||||
|
||||
describe('des', () => {
|
||||
const key = '12345678';
|
||||
|
||||
describe('encrypt', () => {
|
||||
test.each([['foo'], ['bar'], ['你'], ['D']])('%s', (input) => {
|
||||
expect(desEncrypt(input, key)).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
describe('decrypt', () => {
|
||||
test.each([['foo'], ['bar'], ['你'], ['D']])('%s', (input) => {
|
||||
expect(desDecrypt(desEncrypt(input, key), key)).toBe(input);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user