|
3 | 3 | module( 'Sync Engine test' );
|
4 | 4 |
|
5 | 5 | test ( 'AeroGear.DiffSyncEngine should support creation without the new keyword', function() {
|
6 |
| - var engine = AeroGear.DiffSyncEngine({name: 'thing', type: 'diffMatchPatch'}).engines.thing; |
| 6 | + var engine = AeroGear.DiffSyncEngine({type: 'diffMatchPatch'}); |
7 | 7 | ok( engine , 'Should be no problem not using new when creating' );
|
8 | 8 | });
|
9 | 9 |
|
10 | 10 | test( 'add document', function() {
|
11 |
| - var engine = AeroGear.DiffSyncEngine({name: 'thing', type: 'diffMatchPatch'}).engines.thing, doc = { id: 1234, clientId: 'client1', content: { name: 'Fletch' } }; |
| 11 | + var engine = AeroGear.DiffSyncEngine({type: 'diffMatchPatch'}), doc = { id: 1234, clientId: 'client1', content: { name: 'Fletch' } }; |
12 | 12 | engine.addDocument( { id: 1234, clientId: 'client1', content: { name: 'Fletch' } } );
|
13 | 13 | var actualDoc = engine.getDocument( 1234 );
|
14 | 14 | equal( actualDoc.id, 1234, 'Document id should match' );
|
15 | 15 | });
|
16 | 16 |
|
17 | 17 | test( 'diff document', function() {
|
18 |
| - var engine = AeroGear.DiffSyncEngine({name: 'thing', type: 'diffMatchPatch'}).engines.thing; |
| 18 | + var engine = AeroGear.DiffSyncEngine({type: 'diffMatchPatch'}); |
19 | 19 | var doc = { id: 1234, clientId: 'client1', content: { name: 'Fletch' } };
|
20 | 20 | engine.addDocument( doc );
|
21 | 21 |
|
|
46 | 46 | });
|
47 | 47 |
|
48 | 48 | test( 'patch document', function() {
|
49 |
| - var engine = AeroGear.DiffSyncEngine({name: 'thing', type: 'diffMatchPatch'}).engines.thing; |
| 49 | + var engine = AeroGear.DiffSyncEngine({type: 'diffMatchPatch'}); |
50 | 50 | var doc = { id: 1234, clientId: 'client1', content: {name: 'Fletch' } };
|
51 | 51 | engine.addDocument( doc );
|
52 | 52 |
|
|
63 | 63 | });
|
64 | 64 |
|
65 | 65 | test( 'patch shadow - content is a String', function() {
|
66 |
| - var engine = AeroGear.DiffSyncEngine({name: 'thing', type: 'diffMatchPatch'}).engines.thing; |
| 66 | + var engine = AeroGear.DiffSyncEngine({type: 'diffMatchPatch'}); |
67 | 67 | var dmp = new diff_match_patch();
|
68 | 68 | var content = 'Fletch';
|
69 | 69 | var doc = { id: 1234, clientId: 'client1', content: content };
|
|
96 | 96 | });
|
97 | 97 |
|
98 | 98 | test( 'patch shadow - content is an Object', function() {
|
99 |
| - var engine = AeroGear.DiffSyncEngine({name: 'thing', type: 'diffMatchPatch'}).engines.thing; |
| 99 | + var engine = AeroGear.DiffSyncEngine({type: 'diffMatchPatch'}); |
100 | 100 | var dmp = new diff_match_patch();
|
101 | 101 | var content = { name: 'Fletch' };
|
102 | 102 | var doc = { id: 1234, clientId: 'client1', content: content };
|
|
129 | 129 | });
|
130 | 130 |
|
131 | 131 | test( 'already seen edit should be deleted', function() {
|
132 |
| - var engine = AeroGear.DiffSyncEngine({name: 'thing', type: 'diffMatchPatch'}).engines.thing; |
| 132 | + var engine = AeroGear.DiffSyncEngine({type: 'diffMatchPatch'}); |
133 | 133 | var dmp = new diff_match_patch();
|
134 | 134 | var content = { name: 'Fletch' };
|
135 | 135 | var doc = { id: 1234, clientId: 'client1', content: content };
|
|
160 | 160 | });
|
161 | 161 |
|
162 | 162 | test( 'restore from backup', function() {
|
163 |
| - var engine = AeroGear.DiffSyncEngine({name: 'thing', type: 'diffMatchPatch'}).engines.thing; |
| 163 | + var engine = AeroGear.DiffSyncEngine({type: 'diffMatchPatch'}); |
164 | 164 | var dmp = new diff_match_patch();
|
165 | 165 | var content = { name: 'Fletch' };
|
166 | 166 | var doc = { id: 1234, clientId: 'client1', content: content };
|
|
0 commit comments