mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-14 22:17:19 +08:00
AlasGG
This commit is contained in:
15
webapp/packages/preload/tests/unit.spec.ts
Normal file
15
webapp/packages/preload/tests/unit.spec.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import {createHash} from 'crypto';
|
||||
import {expect, test} from 'vitest';
|
||||
import {sha256sum, versions} from '../src';
|
||||
|
||||
test('versions', async () => {
|
||||
expect(versions).toBe(process.versions);
|
||||
});
|
||||
|
||||
test('nodeCrypto', async () => {
|
||||
// Test hashing a random string.
|
||||
const testString = Math.random().toString(36).slice(2, 7);
|
||||
const expectedHash = createHash('sha256').update(testString).digest('hex');
|
||||
|
||||
expect(sha256sum(testString)).toBe(expectedHash);
|
||||
});
|
||||
Reference in New Issue
Block a user