Skip to content

Commit

Permalink
Test JSON narrowing
Browse files Browse the repository at this point in the history
  • Loading branch information
shauns committed Nov 12, 2024
1 parent 585e042 commit 4ecff71
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/cli-kit/src/public/common/ts/json-narrowing.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import {assertStringMap} from './json-narrowing.js'
import {BugError} from '@shopify/cli-kit/node/error'
import {describe, expect, test} from 'vitest'

describe('json-narrowing', () => {
test('assertStringMap', () => {
assertStringMap({yes: 'please'})
})
test('assertStringMap fails on null', () => {
expect(() => assertStringMap(null)).toThrow(BugError)
})
test('assertStringMap fails on non-object', () => {
expect(() => assertStringMap('hello')).toThrow(BugError)
})
})

0 comments on commit 4ecff71

Please sign in to comment.