File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed
Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change 11export { isValid , monotonicFactory , ulid } from "./ulid.js" ;
22export { ulidToUUID , uuidToULID } from "./uuid.js" ;
3- export { fixULIDBase32 } from "./crockford.js" ;
3+ export { fixULIDBase32 , incrementBase32 } from "./crockford.js" ;
44export { ULIDError , ULIDErrorCode } from "./error.js" ;
55export { MAX_ULID , MIN_ULID } from "./constants.js" ;
66export * from "./types.js" ;
Original file line number Diff line number Diff line change 1+ import { describe , expect , it } from "vitest" ;
2+ import { incrementBase32 } from "../../" ;
3+
4+ describe ( "incrementBase32" , ( ) => {
5+ it ( "increments correctly" , ( ) => {
6+ expect ( incrementBase32 ( "A109C" ) ) . toEqual ( "A109D" ) ;
7+ } )
8+
9+ it ( "carries correctly" , ( ) => {
10+ expect ( incrementBase32 ( "A1YZZ" ) ) . toEqual ( "A1Z00" ) ;
11+ } )
12+
13+ it ( "double increments correctly" , ( ) => {
14+ expect ( incrementBase32 ( incrementBase32 ( "A1YZZ" ) ) ) . toEqual ( "A1Z01" ) ;
15+ } )
16+
17+ it ( "throws when it cannot increment" , ( ) => {
18+ expect ( ( ) => {
19+ incrementBase32 ( "ZZZ" )
20+ } ) . toThrow ( / B 3 2 _ E N C _ I N V A L I D / ) ;
21+ } )
22+ } ) ;
You can’t perform that action at this time.
0 commit comments