File tree Expand file tree Collapse file tree 3 files changed +19
-2
lines changed Expand file tree Collapse file tree 3 files changed +19
-2
lines changed Original file line number Diff line number Diff line change 13
13
"build:esm" : " tsc --project tsconfig.json --outDir ./dist/esm" ,
14
14
"test" : " vitest --run" ,
15
15
"test:watch" : " vitest --watch" ,
16
- "attw" : " attw --pack"
16
+ "attw" : " attw --pack" ,
17
+ "prepublishOnly" : " npm run clean && npm run build:cjs && npm run build:esm && npm run attw"
17
18
},
18
19
"exports" : {
19
20
"." : {
Original file line number Diff line number Diff line change 1
- export function uuidFromBigInts ( low128 : bigint , high128 : bigint ) : string {
1
+ export function uuidFromBigInts ( low128 : bigint , high128 : bigint = 0n ) : string {
2
2
// Create a 16-byte buffer
3
3
let bytes = Buffer . alloc ( 16 ) ;
4
4
Original file line number Diff line number Diff line change
1
+ import { expect , test } from "vitest" ;
2
+
3
+ import { bigIntsFromUuid , uuidFromBigInts } from "../dist/esm/uuid.js" ;
4
+ import { Uuid } from "../dist/esm/primitive.js" ;
5
+
6
+ test ( 'UUID' , ( ) => {
7
+ let uuid = '123e4567-e89b-12d3-a456-426614174000' ;
8
+ let { low128, high128 } = bigIntsFromUuid ( uuid ) ;
9
+
10
+ expect ( uuid ) . toEqual ( uuidFromBigInts ( low128 , high128 ) ) ;
11
+ } )
12
+
13
+ test ( 'YDB Uuid Type' , ( ) => {
14
+ let uuid = new Uuid ( '123e4567-e89b-12d3-a456-426614174000' ) ;
15
+ expect ( uuid . toString ( ) ) . toEqual ( '123e4567-e89b-12d3-a456-426614174000' ) ;
16
+ } )
You can’t perform that action at this time.
0 commit comments