(resolver, cb)
| 1475 | }); |
| 1476 | |
| 1477 | function testUpdateConflictIsResolved(resolver, cb) { |
| 1478 | async.series([ |
| 1479 | // sync the new model to ClientB |
| 1480 | sync(ClientB, Server), |
| 1481 | verifyInstanceWasReplicated(ClientA, ClientB, sourceInstanceId), |
| 1482 | |
| 1483 | // ClientA makes a change |
| 1484 | updateSourceInstanceNameTo('a'), |
| 1485 | sync(ClientA, Server), |
| 1486 | |
| 1487 | // ClientB changes the same instance |
| 1488 | updateClientB('b'), |
| 1489 | |
| 1490 | function syncAndResolveConflict(next) { |
| 1491 | replicate(ClientB, Server, function(err, conflicts, cps) { |
| 1492 | if (err) return next(err); |
| 1493 | |
| 1494 | expect(conflicts).to.have.length(1); |
| 1495 | expect(conflicts[0].SourceModel.modelName) |
| 1496 | .to.equal(ClientB.modelName); |
| 1497 | |
| 1498 | debug('Resolving the conflict %j', conflicts[0]); |
| 1499 | resolver(conflicts[0], next); |
| 1500 | }); |
| 1501 | }, |
| 1502 | |
| 1503 | // repeat the last sync, it should pass now |
| 1504 | sync(ClientB, Server), |
| 1505 | // and sync back to ClientA too |
| 1506 | sync(ClientA, Server), |
| 1507 | |
| 1508 | verifyInstanceWasReplicated(ClientB, ClientA, sourceInstanceId), |
| 1509 | ], cb); |
| 1510 | } |
| 1511 | |
| 1512 | function testDeleteConflictIsResolved(resolver, cb) { |
| 1513 | async.series([ |
no test coverage detected
searching dependent graphs…