diff --git a/packages/datastore/__tests__/outbox.test.ts b/packages/datastore/__tests__/outbox.test.ts index c74f1866d2e..06f21f7f1f5 100644 --- a/packages/datastore/__tests__/outbox.test.ts +++ b/packages/datastore/__tests__/outbox.test.ts @@ -33,7 +33,7 @@ describe('Outbox tests', () => { beforeAll(async () => { jest.resetAllMocks(); - await initializeOutbox(); + await instantiateOutbox(); const newModel = new Model({ field1: 'Some value', @@ -207,13 +207,13 @@ describe('Outbox tests', () => { await Storage.runExclusive(async s => { // process mutation response, which dequeues updatedModel1 - // and syncs its version to the remaining item in the mutation queue + // but SHOULD NOT sync the _version, since the data in the response is different await processMutationResponse(s, response); const inProgress = await outbox.peek(s); const inProgressData = JSON.parse(inProgress.data); - // updatedModel3 should now be in progress with the _version from the mutation response + // updatedModel2 should now be in progress with the _version from the mutation response expect(inProgressData.field1).toEqual('another value2'); const oldVersion = (modelData as any)._version; @@ -231,7 +231,7 @@ describe('Outbox tests', () => { // performs all the required dependency injection // in order to have a functional Outbox without the Sync Engine -async function initializeOutbox(): Promise { +async function instantiateOutbox(): Promise { ({ initSchema, DataStore } = require('../src/datastore/datastore')); const classes = initSchema(testSchema()); const ownSymbol = Symbol('sync'); diff --git a/packages/datastore/src/util.ts b/packages/datastore/src/util.ts index 38bf7f270e4..ca987bcb51d 100644 --- a/packages/datastore/src/util.ts +++ b/packages/datastore/src/util.ts @@ -468,7 +468,10 @@ export function objectsEqual(objA: object, objB: object): boolean { let a = objA; let b = objB; - if (Array.isArray(a) && !Array.isArray(b)) { + if ( + (Array.isArray(a) && !Array.isArray(b)) || + (Array.isArray(b) && !Array.isArray(a)) + ) { return false; } diff --git a/scripts/build.js b/scripts/build.js index 61b9097aea7..8b133b08cf6 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -157,7 +157,13 @@ async function buildES5(typeScriptCompiler) { let compilerOptions = { esModuleInterop: true, noImplicitAny: false, - lib: ['dom', 'es2017', 'esnext.asynciterable', 'es2018.asyncgenerator'], + lib: [ + 'dom', + 'es2017', + 'esnext.asynciterable', + 'es2018.asyncgenerator', + 'es2019.object', + ], downlevelIteration: true, jsx: jsx, sourceMap: true, @@ -202,7 +208,13 @@ function buildES6(typeScriptCompiler) { let compilerOptions = { esModuleInterop: true, noImplicitAny: false, - lib: ['dom', 'es2017', 'esnext.asynciterable', 'es2018.asyncgenerator'], + lib: [ + 'dom', + 'es2017', + 'esnext.asynciterable', + 'es2018.asyncgenerator', + 'es2019.object', + ], downlevelIteration: true, jsx: jsx, sourceMap: true,