diff --git a/packages/cli-kit/src/public/common/ts/json-narrowing.test.ts b/packages/cli-kit/src/public/common/ts/json-narrowing.test.ts new file mode 100644 index 0000000000..fb75c493e2 --- /dev/null +++ b/packages/cli-kit/src/public/common/ts/json-narrowing.test.ts @@ -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) + }) +})