From c9f2458775c4b231a179e8348805614ccc0f60e9 Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Wed, 16 Oct 2024 01:09:04 +0800 Subject: [PATCH] test: update md5 unit test --- src/server/utils/__tests__/common.test.ts | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/server/utils/__tests__/common.test.ts b/src/server/utils/__tests__/common.test.ts index 86bbb67..e5738d9 100644 --- a/src/server/utils/__tests__/common.test.ts +++ b/src/server/utils/__tests__/common.test.ts @@ -2,7 +2,22 @@ import { describe, expect, test } from 'vitest'; import { md5 } from '../common.js'; describe('md5', () => { - test('normal test', async () => { - expect(md5('Hello world')).toBe('3e25960a79dbc69b674cd4ec67a72c62'); + test('should return the correct md5 hash', () => { + 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); }); });