Skip to content

Commit

Permalink
chore: fix tc running
Browse files Browse the repository at this point in the history
  • Loading branch information
Aman035 committed Jul 18, 2024
1 parent 34dddbb commit e2b1b2f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 36 deletions.
33 changes: 13 additions & 20 deletions packages/restapi/tests/lib/notification/tags.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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 () => {
Expand All @@ -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);
Expand All @@ -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');
Expand Down
34 changes: 18 additions & 16 deletions packages/restapi/tests/root.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},
};
};

0 comments on commit e2b1b2f

Please sign in to comment.