Skip to content

Commit 6ba855e

Browse files
committed
Add test for merge with context.
1 parent 74332fa commit 6ba855e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/misc.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ describe('merge tests', () => {
2828
const docA = {'@id': 'ex:1', 'a:foo': [{'@value': 1}]};
2929
const docB = {'@id': 'ex:1', 'b:foo': [{'@value': 2}]};
3030
const merged = [Object.assign({}, docA, docB)];
31+
const context = {};
32+
const ctxMerged = {'@graph': [{'@id': 'ex:1', 'a:foo': 1, 'b:foo': 2}]};
3133

3234
it('should merge nodes from two different documents', done => {
3335
jsonld.merge([docA, docB], (err, output) => {
@@ -36,6 +38,14 @@ describe('merge tests', () => {
3638
done();
3739
});
3840
});
41+
42+
it('should merge nodes from two different documents with context', done => {
43+
jsonld.merge([docA, docB], context, (err, output) => {
44+
assert.ifError(err);
45+
assert.deepEqual(output, ctxMerged);
46+
done();
47+
});
48+
});
3949
});
4050

4151
describe('createNodeMap', () => {

0 commit comments

Comments
 (0)