diff options
Diffstat (limited to 'tst/tagged_object.test.ts')
| -rw-r--r-- | tst/tagged_object.test.ts | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tst/tagged_object.test.ts b/tst/tagged_object.test.ts new file mode 100644 index 0000000..51b6c81 --- /dev/null +++ b/tst/tagged_object.test.ts @@ -0,0 +1,16 @@ +import { isObject, isTagged } from '../lib/index'; + +describe('types/tagged + types/object', () => { + test('isObject excludes null/arrays', () => { + expect(isObject({})).toBe(true); + expect(isObject([])).toBe(false); + expect(isObject(null)).toBe(false); + expect(isObject('x')).toBe(false); + }); + + test('isTagged checks _tag field', () => { + expect(isTagged({ _tag: 'X' }, 'X')).toBe(true); + expect(isTagged({ _tag: 'Y' }, 'X')).toBe(false); + expect(isTagged({}, 'X')).toBe(false); + }); +}); |
