Skip to content

Commit c9f2458

Browse files
committed
test: update md5 unit test
1 parent f553f15 commit c9f2458

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

src/server/utils/__tests__/common.test.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,22 @@ import { describe, expect, test } from 'vitest';
22
import { md5 } from '../common.js';
33

44
describe('md5', () => {
5-
test('normal test', async () => {
6-
expect(md5('Hello world')).toBe('3e25960a79dbc69b674cd4ec67a72c62');
5+
test('should return the correct md5 hash', () => {
6+
const input = 'test';
7+
const expectedHash = '098f6bcd4621d373cade4e832627b4f6';
8+
9+
const result = md5(input);
10+
11+
expect(result).toEqual(expectedHash);
12+
});
13+
14+
test('should handle different inputs', () => {
15+
const input1 = 'hello';
16+
const input2 = 'world';
17+
18+
const result1 = md5(input1);
19+
const result2 = md5(input2);
20+
21+
expect(result1).not.toEqual(result2);
722
});
823
});

0 commit comments

Comments
 (0)