Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
36 lines
895 B
JavaScript
Executable file
36 lines
895 B
JavaScript
Executable file
/* Any copyright is dedicated to the Public Domain.
|
|
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
'use strict';
|
|
|
|
/* exported
|
|
AdapterMock
|
|
*/
|
|
|
|
var AdapterMock = (action, args) => {
|
|
return {
|
|
update(kintoColl, options) {
|
|
AdapterMock.options = options;
|
|
if (action === 'noop') {
|
|
// Even if the adapter makes changes, we want to see that
|
|
// SyncEngine does not sync those changes up if the adapter
|
|
// return false.
|
|
return kintoColl.update.apply(kintoColl, args).then(() => {
|
|
return false;
|
|
});
|
|
}
|
|
if (action) {
|
|
return kintoColl[action].apply(kintoColl, args).then(() => {
|
|
return true;
|
|
});
|
|
}
|
|
return Promise.resolve(false);
|
|
},
|
|
handleConflict(conflict) {
|
|
return Promise.resolve(conflict.local);
|
|
},
|
|
reset() {
|
|
return Promise.resolve();
|
|
}
|
|
};
|
|
};
|