From 0bf1b9b8927380f48e42bd4f86ad273e869e059b Mon Sep 17 00:00:00 2001 From: Aman Gupta Date: Thu, 18 Jul 2024 19:03:40 +0530 Subject: [PATCH] chore: fix tc running (#1379) --- .../tests/lib/notification/tags.test.ts | 33 +++++++----------- packages/restapi/tests/root.ts | 34 ++++++++++--------- 2 files changed, 31 insertions(+), 36 deletions(-) diff --git a/packages/restapi/tests/lib/notification/tags.test.ts b/packages/restapi/tests/lib/notification/tags.test.ts index f191da8dd..e0b1abf98 100644 --- a/packages/restapi/tests/lib/notification/tags.test.ts +++ b/packages/restapi/tests/lib/notification/tags.test.ts @@ -55,26 +55,24 @@ describe('PushAPI.tags functionality', () => { describe('tags :: add', () => { // TODO: remove skip after signer becomes optional it('Without signer and account :: should throw error', async () => { - await expect(() => - userBob.channel.tags.add(['tag1', 'tag2', 'tag3']) - ).to.Throw; + await expect(() => userBob.channel.tags.add(['tag1', 'tag2', 'tag3'])).to + .Throw; }); it('With signer and without provider :: should throw error', async () => { - await expect(() => - userAlice.channel.tags.add(['tag1', 'tag2', 'tag3']) - ).to.Throw; + await expect(() => userAlice.channel.tags.add(['tag1', 'tag2', 'tag3'])) + .to.Throw; }); it('With signer and provider :: should add tags', async () => { - const tags = ['tag1', 'tag2', 'tag3'] + const tags = ['tag1', 'tag2', 'tag3']; const res = await userKate.channel.tags.add(tags); expect(res).not.null; expect(res.tags).equal(tags); }, 100000000); it('With viem signer and provider :: should add tags', async () => { - const tags = ['tag1', 'tag2', 'tag3'] + const tags = ['tag1', 'tag2', 'tag3']; const res = await viemUser.channel.tags.add(tags); expect(res).not.null; expect(res.tags).equal(tags); @@ -84,9 +82,8 @@ describe('PushAPI.tags functionality', () => { describe('tags :: update', () => { // TODO: remove skip after signer becomes optional it('Without signer and account :: should throw error', async () => { - await expect(() => - userBob.channel.tags.update(['tag1', 'tag2', 'tag3']) - ).to.Throw; + await expect(() => userBob.channel.tags.update(['tag1', 'tag2', 'tag3'])) + .to.Throw; }); it('With signer and without provider :: should throw error', async () => { @@ -96,13 +93,13 @@ describe('PushAPI.tags functionality', () => { }); it('With signer and provider :: should update tags', async () => { - const tags = ['tag1', 'tag2', 'tag3'] + const tags = ['tag1', 'tag2', 'tag3']; const res = await userKate.channel.tags.update(tags); expect(res.tags).equal(tags); }, 100000000); it('With viem signer and provider :: should update tags', async () => { - const tags = ['tag1', 'tag2', 'tag3'] + const tags = ['tag1', 'tag2', 'tag3']; const res = await viemUser.channel.tags.update(tags); expect(res.tags).equal(tags); }, 100000000); @@ -111,18 +108,14 @@ describe('PushAPI.tags functionality', () => { describe('tags :: remove', () => { // TODO: remove skip after signer becomes optional it('Without signer and account :: should throw error', async () => { - await expect(() => - userBob.channel.tags.remove() - ).to.Throw; + await expect(() => userBob.channel.tags.remove()).to.Throw; }); it('With signer and without provider :: should throw error', async () => { - await expect(() => - userAlice.channel.tags.remove() - ).to.Throw; + await expect(() => userAlice.channel.tags.remove()).to.Throw; }); - it.only('With signer and provider :: should remove tags', async () => { + it('With signer and provider :: should remove tags', async () => { await userKate.channel.tags.update(['tag1', 'tag2', 'tag3']); const res = await userKate.channel.tags.remove(); expect(res.status).equal('success'); diff --git a/packages/restapi/tests/root.ts b/packages/restapi/tests/root.ts index 3e36df7a9..3ef257559 100644 --- a/packages/restapi/tests/root.ts +++ b/packages/restapi/tests/root.ts @@ -3,27 +3,29 @@ import * as path from 'path'; export const mochaHooks = { // This file is needed to end the test suite. - beforeAll: [ - async function () { + beforeAll: [ + async function () { // Load .env file - const envFound = dotenv.config({ path: path.resolve(__dirname, './.env')}) + const envFound = dotenv.config({ + path: path.resolve(__dirname, './.env'), + }); // check if .env exists - if (!envFound) { - console.log(' .env NOT FOUND '); - process.exit(1); - } else { - // Check environment setup first - console.log(' Verifying ENV ') - const EnvVerifierLoader = (await require('./loaders/envVerifier')).default - await EnvVerifierLoader() - console.log(' ENV Verified / Generated and Loaded! ') - } - }, - ], + // if (!envFound) { + // console.log(' .env NOT FOUND '); + // process.exit(1); + // } else { + // // Check environment setup first + // console.log(' Verifying ENV ') + // const EnvVerifierLoader = (await require('./loaders/envVerifier')).default + // await EnvVerifierLoader() + // console.log(' ENV Verified / Generated and Loaded! ') + // } + }, + ], afterAll(done: () => void) { done(); console.log(' ALL TEST CASES EXECUTED '); process.exit(0); }, -}; \ No newline at end of file +};