Skip to content

Commit

Permalink
include es2019.object lib
Browse files Browse the repository at this point in the history
  • Loading branch information
iartemiev committed Mar 25, 2021
1 parent fe75871 commit 53989a5
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
8 changes: 4 additions & 4 deletions packages/datastore/__tests__/outbox.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe('Outbox tests', () => {
beforeAll(async () => {
jest.resetAllMocks();

await initializeOutbox();
await instantiateOutbox();

const newModel = new Model({
field1: 'Some value',
Expand Down Expand Up @@ -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;
Expand All @@ -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<void> {
async function instantiateOutbox(): Promise<void> {
({ initSchema, DataStore } = require('../src/datastore/datastore'));
const classes = initSchema(testSchema());
const ownSymbol = Symbol('sync');
Expand Down
5 changes: 4 additions & 1 deletion packages/datastore/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
16 changes: 14 additions & 2 deletions scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 53989a5

Please sign in to comment.