Skip to content

Commit

Permalink
Update textToHex.test.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
Gigabyte5671 authored Dec 26, 2022
1 parent 26e22c3 commit 36b95d1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/textToHex.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import { performance } from 'perf_hooks';
import { textToHex } from '../functions/Utils.js';

const data = `!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\`abcdefghijklmnopqrstuvwxyz{|}~ Tribes`;

const expectedResult = `[33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,32,84,114,105,98,101,115]`;

// <Test>
const startTime = performance.now();
const array = textToHex(data);
const endTime = performance.now();
// </Test>

if (!array) {
throw new Error('Output is null.');
Expand All @@ -18,4 +23,4 @@ if (JSON.stringify([...array]) !== expectedResult) {
throw new Error('Output value is incorrect.');
}

console.log('Test passed.');
console.log(`Passed in ${endTime - startTime}ms.`);

0 comments on commit 36b95d1

Please sign in to comment.