summaryrefslogtreecommitdiff
path: root/tst/tagged_object.test.ts
diff options
context:
space:
mode:
authorElizabeth Hunt <me@liz.coffee>2025-12-14 22:39:18 -0800
committerElizabeth Hunt <me@liz.coffee>2025-12-14 22:39:18 -0800
commit666674327f009e9b1013218fc384f193b64c6997 (patch)
treeacebae7b425b469584eb0a5bec396899c2739501 /tst/tagged_object.test.ts
parent594ce452693a71b501d3aff3f35ef3732c06c341 (diff)
downloadpengueno-666674327f009e9b1013218fc384f193b64c6997.tar.gz
pengueno-666674327f009e9b1013218fc384f193b64c6997.zip
Adds unit tests
Diffstat (limited to 'tst/tagged_object.test.ts')
-rw-r--r--tst/tagged_object.test.ts16
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);
+ });
+});