mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-25 18:05:26 +00:00
16 lines
460 B
TypeScript
16 lines
460 B
TypeScript
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);
|
|
});
|