(resolver, cb)
| 1510 | } |
| 1511 | |
| 1512 | function testDeleteConflictIsResolved(resolver, cb) { |
| 1513 | async.series([ |
| 1514 | // sync the new model to ClientB |
| 1515 | sync(ClientB, Server), |
| 1516 | verifyInstanceWasReplicated(ClientA, ClientB, sourceInstanceId), |
| 1517 | |
| 1518 | // ClientA makes a change |
| 1519 | function deleteInstanceOnClientA(next) { |
| 1520 | ClientA.deleteById(sourceInstanceId, next); |
| 1521 | }, |
| 1522 | |
| 1523 | sync(ClientA, Server), |
| 1524 | |
| 1525 | // ClientB changes the same instance |
| 1526 | updateClientB('b'), |
| 1527 | |
| 1528 | function syncAndResolveConflict(next) { |
| 1529 | replicate(ClientB, Server, function(err, conflicts, cps) { |
| 1530 | if (err) return next(err); |
| 1531 | |
| 1532 | expect(conflicts).to.have.length(1); |
| 1533 | expect(conflicts[0].SourceModel.modelName) |
| 1534 | .to.equal(ClientB.modelName); |
| 1535 | |
| 1536 | debug('Resolving the conflict %j', conflicts[0]); |
| 1537 | resolver(conflicts[0], next); |
| 1538 | }); |
| 1539 | }, |
| 1540 | |
| 1541 | // repeat the last sync, it should pass now |
| 1542 | sync(ClientB, Server), |
| 1543 | // and sync back to ClientA too |
| 1544 | sync(ClientA, Server), |
| 1545 | |
| 1546 | verifyInstanceWasReplicated(ClientB, ClientA, sourceInstanceId), |
| 1547 | ], cb); |
| 1548 | } |
| 1549 | |
| 1550 | function updateClientB(name) { |
| 1551 | return function updateInstanceB(next) { |
no test coverage detected
searching dependent graphs…