Skip to content

Commit

Permalink
add test for IdGenerator
Browse files Browse the repository at this point in the history
  • Loading branch information
davidjgoss committed Feb 7, 2025
1 parent c2ca483 commit 41f9ddd
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions javascript/test/IdGeneratorTest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import assert from "node:assert"
import {IdGenerator} from "../src/index.js"

describe('IdGenerator', () => {
it('generates uuids', () => {
const generator = IdGenerator.uuid()
const result = generator()
assert.equal(result.length, 36)
});

it('increments ids', () => {
const generator = IdGenerator.incrementing()
assert.equal(generator(), '0')
assert.equal(generator(), '1')
assert.equal(generator(), '2')
})
})

0 comments on commit 41f9ddd

Please sign in to comment.