-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
32 lines (31 loc) · 899 Bytes
/
test.js
File metadata and controls
32 lines (31 loc) · 899 Bytes
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
import { describe, it } from 'node:test'
import assert from 'node:assert/strict'
import { process } from './main.js'
describe('process', () => {
it('turns an object into an array of strings', () => {
const result = process({
foo: 'bar',
biz: 'baz',
})
assert.deepEqual(result, ['bar', 'baz'])
})
it('turns an object with space-separated strings into an array of strings', () => {
const result = process({
foo: 'bar wombat',
biz: 'baz llama',
})
assert.deepEqual(result, ['bar', 'wombat', 'baz', 'llama'])
})
it('turns a nested-object with space-separated strings into an array of strings', () => {
const result = process({
foo: {
kombat: { bar: 'wombat' },
nested: 'value',
},
biz: {
llama: { baz: 'alpaca' },
},
})
assert.deepEqual(result, ['wombat', 'value', 'alpaca'])
})
})