Skip to content

Commit

Permalink
update Id tests
Browse files Browse the repository at this point in the history
  • Loading branch information
StevenClontz committed Nov 25, 2023
1 parent 7bc538d commit 766b660
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions packages/core/test/Id.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,33 @@ describe('toInt', () => {
expect(toInt('T000100')).toEqual(100)
})

it('does not require a leading prefix', () => {
it('does not require leading zeros', () => {
expect(toInt('P12')).toEqual(12)
})

it('does not match unknown types', () => {
it('does not match nonexistent kinds', () => {
expect(toInt('Z000100')).toEqual(0)
})

it('matches unknown kind', () => {
expect(toInt('000123')).toEqual(123)
})
})

describe('trim', () => {
it('trims down to the numeric content', () => {
expect(trim('T000100')).toEqual('100')
expect(toInt('T000100')).toEqual(100)
})

it('does not require a leading prefix', () => {
expect(trim('P12')).toEqual('12')
it('does not require leading zeros', () => {
expect(toInt('P12')).toEqual(12)
})

it('does not match nonexistent kinds', () => {
expect(toInt('Z000100')).toEqual(0)
})

it('does not match unknown types', () => {
expect(trim('Z000100')).toEqual('Z000100')
it('matches unknown kind', () => {
expect(toInt('000123')).toEqual(123)
})
})

0 comments on commit 766b660

Please sign in to comment.