-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathisolate.js
31 lines (28 loc) · 992 Bytes
/
isolate.js
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
import describe from 'tape-bdd';
import { isolate, transmute } from 'transmutation';
describe('Isolate', (it) => {
it('accepts a path and value to isolate', assert => transmute({ parameter: 'roar' })
.then(value => assert.deepEqual(isolate('parameter', value), 'roar'))
);
it('isolates a value for extending', assert => transmute({ parameter: 'roar' })
.extend('extension', isolate('parameter'))
.then(value => assert.deepEqual(value, {
parameter: 'roar',
extension: 'roar',
}))
);
it('isolates an array of paths from a value for extending', assert => transmute({
parameter: 'roar',
second: 'test',
})
.extend('body', isolate(['parameter', 'second']))
.then(value => assert.deepEqual(value, {
parameter: 'roar',
second: 'test',
body: {
parameter: 'roar',
second: 'test',
},
}))
);
});