diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b3eba58..77ed5cc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,6 +21,9 @@ jobs: uses: supercharge/mongodb-github-action@1.10.0 with: mongodb-version: ${{ matrix.mongodb-version }} + mongodb-username: ssp-relay-user + mongodb-password: ssp-relay-password + mongodb-db: ssp-relay - name: npm install run: npm i - name: Setup CI config diff --git a/tests/unit/actionService.spec.ts b/tests/unit/actionService.spec.ts index ae14df0..e75749c 100644 --- a/tests/unit/actionService.spec.ts +++ b/tests/unit/actionService.spec.ts @@ -30,7 +30,7 @@ describe('Action Service', () => { const db = await serviceHelper.databaseConnection(); database = db.db(config.database.database); actionCollection = config.collections.v1action; - await database.collection(actionCollection).drop(); + await database.collection(actionCollection).drop().catch(() => {}); }); afterEach(function() { diff --git a/tests/unit/notificationService.spec.ts b/tests/unit/notificationService.spec.ts index 6e071ee..dfeddca 100644 --- a/tests/unit/notificationService.spec.ts +++ b/tests/unit/notificationService.spec.ts @@ -55,8 +55,8 @@ describe('Notification Service', () => { }); // Currently there is a limitation in testing the firebase - it.skip('should return error when it sends key to firebase', async () => { - await database.collection(tokenCollection).drop() + it('should return error when it sends key to firebase', async () => { + await database.collection(tokenCollection).drop().catch(() => {}); await notificationService.sendNotificationKey(141, dataNoAction).catch(e => { expect(e).to.not.be.null; expect(e).to.not.be.undefined; diff --git a/tests/unit/socketService.spec.ts b/tests/unit/socketService.spec.ts index dcd2110..c41322f 100644 --- a/tests/unit/socketService.spec.ts +++ b/tests/unit/socketService.spec.ts @@ -30,7 +30,7 @@ describe('Socket Service', () => { const db = await serviceHelper.databaseConnection(); database = db.db(config.database.database); socketCollection = config.collections.v1action; - await database.collection(socketCollection).drop(); + await database.collection(socketCollection).drop().catch(() => {});; }); afterEach(function() { diff --git a/tests/unit/syncService.spec.ts b/tests/unit/syncService.spec.ts index 27af6c0..dc4a44e 100644 --- a/tests/unit/syncService.spec.ts +++ b/tests/unit/syncService.spec.ts @@ -43,7 +43,7 @@ describe('Sync Service', () => { const db = await serviceHelper.databaseConnection(); database = db.db(config.database.database); syncCollection = config.collections.v1sync; - await database.collection(syncCollection).drop(); + await database.collection(syncCollection).drop().catch(() => {}); await database.collection(syncCollection).insertMany(testInsertV1Sync); }); @@ -75,7 +75,7 @@ describe('Sync Service', () => { }); it('should return error after database drop and id is invalid', async () => { - await database.collection(syncCollection).drop(); + await database.collection(syncCollection).drop().catch(() => {});; await syncService.getSync(141).catch((e) => assert.equal(e, 'Error: Sync 141 not found')); }); @@ -151,7 +151,7 @@ describe('Sync Service', () => { const db = await serviceHelper.databaseConnection(); database = db.db(config.database.database); tokenCollection = config.collections.v1token; - await database.collection(tokenCollection).drop(); + await database.collection(tokenCollection).drop().catch(() => {});; await database.collection(tokenCollection).insertMany(testInsertV1Tokens); }); @@ -183,7 +183,7 @@ describe('Sync Service', () => { }); it('should return error after database drop and id is invalid', async () => { - await database.collection(tokenCollection).drop(); + await database.collection(tokenCollection).drop().catch(() => {});; await syncService.getTokens(141).catch((e) => assert.equal(e, 'Error: Sync 141 not found')); });