-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added basic collection tests for references
- Loading branch information
Jim de Beer
committed
May 1, 2016
1 parent
86e1ebc
commit c1f1acc
Showing
7 changed files
with
72 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
'use strict' | ||
// require('./basic') | ||
// require('./collection') | ||
require('./reference') | ||
require('./references') | ||
// require('./root') |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
'use strict' | ||
const test = require('tape') | ||
const subsTest = require('../test') | ||
|
||
test('reference - basic', function (t) { | ||
const s = subsTest( | ||
t, | ||
{ a: 'a', b: { ref: '$root.a' } }, | ||
{ b: { ref: true } } | ||
) | ||
|
||
s( | ||
'initial subscription', | ||
[{ path: 'b/ref', type: 'new' }], | ||
{ b: { $: 1, ref: 1 } } | ||
) | ||
|
||
s( | ||
'referenced field origin', | ||
[{ path: 'b/ref', type: 'update' }], | ||
{ b: { $: 2, ref: 2 } }, | ||
{ a: 'a-update' } | ||
) | ||
|
||
t.end() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
'use strict' | ||
const test = require('tape') | ||
const subsTest = require('../test') | ||
|
||
test('reference - collection', function (t) { | ||
const s = subsTest( | ||
t, | ||
{ | ||
0: 'its zero', | ||
1: 'its 1', | ||
collection: { | ||
0: '$root.0', | ||
1: '$root.1' | ||
} | ||
}, | ||
{ | ||
collection: { | ||
$any: true | ||
} | ||
} | ||
) | ||
|
||
s( | ||
'initial subscription', | ||
[ | ||
{ path: 'collection/0', type: 'new' }, | ||
{ path: 'collection/1', type: 'new' } | ||
] | ||
) | ||
|
||
s( | ||
'update 0', | ||
[ | ||
{ path: 'collection/0', type: 'update' } | ||
], | ||
false, | ||
{ 0: 'hello its an update in zero' } | ||
) | ||
|
||
t.end() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
'use strict' | ||
require('./basic') | ||
require('./collection') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters