Skip to content

Commit 389fd85

Browse files
authored
Merge pull request #2565 from strongloop/fix/misconfigured-change-replication
test: fix change-tracking setup
2 parents ea21169 + fd0b6fc commit 389fd85

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

test/remote-connector.test.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,24 @@ describe('RemoteConnector', function() {
2525
done();
2626
});
2727
},
28+
29+
// We are defining the model attached to the remote connector datasource,
30+
// therefore change tracking must be disabled, only the remote API for
31+
// replication should be present
32+
trackChanges: false,
33+
enableRemoteReplication: true,
34+
2835
onDefine: function(Model) {
29-
var RemoteModel = Model.extend('Remote' + Model.modelName, {},
30-
{ plural: Model.pluralModelName });
31-
RemoteModel.attachTo(loopback.createDataSource({
36+
var ServerModel = Model.extend('Server' + Model.modelName, {}, {
37+
plural: Model.pluralModelName,
38+
// This is the model running on the server & attached to a real
39+
// datasource, that's the place where to keep track of changes
40+
trackChanges: true,
41+
});
42+
ServerModel.attachTo(loopback.createDataSource({
3243
connector: loopback.Memory,
3344
}));
34-
remoteApp.model(RemoteModel);
45+
remoteApp.model(ServerModel);
3546
},
3647
});
3748

test/util/model-tests.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ module.exports = function defineModelTestsWithDataSource(options) {
4848
'domain': String,
4949
'email': String,
5050
}, {
51-
trackChanges: true,
51+
trackChanges: options.trackChanges !== false,
52+
enableRemoteReplication: options.enableRemoteReplication,
5253
});
5354

5455
User.attachTo(dataSource);

0 commit comments

Comments
 (0)