You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tailchat/server/lib/crypto/__tests__/des.spec.ts

18 lines
455 B
TypeScript

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);
});
});
});