test: update md5 unit test

This commit is contained in:
moonrailgun 2024-10-16 01:09:04 +08:00
parent f553f157dd
commit c9f2458775

View File

@ -2,7 +2,22 @@ import { describe, expect, test } from 'vitest';
import { md5 } from '../common.js'; import { md5 } from '../common.js';
describe('md5', () => { describe('md5', () => {
test('normal test', async () => { test('should return the correct md5 hash', () => {
expect(md5('Hello world')).toBe('3e25960a79dbc69b674cd4ec67a72c62'); const input = 'test';
const expectedHash = '098f6bcd4621d373cade4e832627b4f6';
const result = md5(input);
expect(result).toEqual(expectedHash);
});
test('should handle different inputs', () => {
const input1 = 'hello';
const input2 = 'world';
const result1 = md5(input1);
const result2 = md5(input2);
expect(result1).not.toEqual(result2);
}); });
}); });