From ecfec4620fa7b5191b22b127cab630fbdbdb2dd8 Mon Sep 17 00:00:00 2001 From: Joshua Kuestersteffen Date: Wed, 9 Oct 2024 16:04:06 -0500 Subject: [PATCH] Fix some flaky unit tests --- test/fn/compile-app-settings.spec.js | 2 +- test/fn/move-contacts.spec.js | 5 ++--- test/fn/watch-project.spec.js | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/test/fn/compile-app-settings.spec.js b/test/fn/compile-app-settings.spec.js index b987140a5..56abd5e7e 100644 --- a/test/fn/compile-app-settings.spec.js +++ b/test/fn/compile-app-settings.spec.js @@ -158,6 +158,6 @@ describe('compile-app-settings', () => { .excludingEvery(['rules', 'contact_summary']) .to.deep.eq(expected); } - }); + }).timeout(4000); } }); diff --git a/test/fn/move-contacts.spec.js b/test/fn/move-contacts.spec.js index ba4b8a01c..a7f471282 100644 --- a/test/fn/move-contacts.spec.js +++ b/test/fn/move-contacts.spec.js @@ -5,7 +5,7 @@ const fs = require('../../src/lib/sync-fs'); const environment = require('../../src/lib/environment'); const PouchDB = require('pouchdb-core'); -PouchDB.plugin(require('pouchdb-adapter-http')); +PouchDB.plugin(require('pouchdb-adapter-memory')); PouchDB.plugin(require('pouchdb-mapreduce')); const moveContactsModule = rewire('../../src/fn/move-contacts'); @@ -50,8 +50,7 @@ describe('move-contacts', () => { const updateHierarchyRules = contact_types => upsert('settings', { settings: { contact_types } }); beforeEach(async () => { - // using remote couchdb because of https://github.com/pouchdb/pouchdb/issues/8370 - pouchDb = new PouchDB(`http://localhost:6984/scenario${scenarioCount++}`); + pouchDb = new PouchDB(`move-contacts-${scenarioCount++}`); await mockHierarchy(pouchDb, { district_1: { diff --git a/test/fn/watch-project.spec.js b/test/fn/watch-project.spec.js index 2bef1a762..a0f7b58ea 100644 --- a/test/fn/watch-project.spec.js +++ b/test/fn/watch-project.spec.js @@ -152,7 +152,7 @@ describe('watch-project', () => { .then(mockApi.getAppSettings) .then((settings) => JSON.parse(settings.content)) .then((settings) => expect(settings.locale).equal('es')); - }); + }).timeout(16000); it('watch-project: convert app settings', () => { const appSettingsPath = path.join(testDir, 'app_settings.json'); @@ -178,7 +178,7 @@ describe('watch-project', () => { .then(messages => { assert.deepEqual(messages.custom, { a: 'first', test: 'new' }); }); - }); + }).timeout(16000); it('watch-project: upload resources', () => { return watchWrapper(editResources, 'resources.json')