-
Notifications
You must be signed in to change notification settings - Fork 0
/
duad.test.ts
38 lines (34 loc) · 1.05 KB
/
duad.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { describe, it } from 'node:test'
import * as assert from 'node:assert'
import * as duad from './duad.ts'
describe('duad', () => {
describe('of', () => {
it('should return array of 2 elements', () => {
assert.deepEqual(duad.of(1, 2), [1, 2])
})
})
describe('duad', () => {
it('should return array of 2 elements', () => {
assert.deepEqual(
duad.duad(1)(2),
[1, 2]
)
})
})
describe('prefix', () => {
it('should provide prefix to a value, producing a duad', () => {
assert.deepEqual(
duad.prefix((x: { test: string }) => x.test)({ test: 'test' }),
['test', { test: 'test' }]
)
})
})
describe('suffix', () => {
it('should provide prefix to a value, producing a duad', () => {
assert.deepEqual(
duad.suffix((x: { test: string }) => x.test)({ test: 'test' }),
[{ test: 'test' }, 'test']
)
})
})
})