source: imaps-frontend/node_modules/uuid/dist/esm-browser/test/stringify.test.js

main
Last change on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 946 bytes
Line 
1import * as assert from 'assert';
2import test, { describe } from 'node:test';
3import stringify, { unsafeStringify } from '../stringify.js';
4const BYTES = Uint8Array.of(0x0f, 0x5a, 0xbc, 0xd1, 0xc1, 0x94, 0x47, 0xf3, 0x90, 0x5b, 0x2d, 0xf7, 0x26, 0x3a, 0x08, 0x4b);
5describe('stringify', () => {
6 test('Stringify Array (unsafe)', () => {
7 assert.equal(unsafeStringify(BYTES), '0f5abcd1-c194-47f3-905b-2df7263a084b');
8 });
9 test('Stringify w/ offset (unsafe)', () => {
10 const bytes = new Uint8Array(19).fill(0);
11 bytes.set(BYTES, 3);
12 assert.equal(unsafeStringify(bytes, 3), '0f5abcd1-c194-47f3-905b-2df7263a084b');
13 });
14 test('Stringify Array (safe)', () => {
15 assert.equal(stringify(BYTES), '0f5abcd1-c194-47f3-905b-2df7263a084b');
16 });
17 test('Throws on not enough values (safe)', () => {
18 const bytes = BYTES.slice(0, 15);
19 assert.throws(() => stringify(bytes));
20 });
21});
Note: See TracBrowser for help on using the repository browser.