Skip to content

Commit

Permalink
test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
GSinseswa721 authored and elijahladdie committed Jun 4, 2024
1 parent 5228fb0 commit 15b8bc5
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 7 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ env:
GOOGLE_CLIENT_ID: ${{secrets.GOOGLE_CLIENT_ID}}
GOOGLE_CLIENT_SECRET: ${{secrets.GOOGLE_CLIENT_SECRET}}

TEST_USER_EMAIL: ${{secrets.TEST_USER_EMAIL}}
TEST_USER_PASS: ${{secrets.TEST_USER_PASS}}
TEST_VENDOR_EMAIL: ${{secrets.TEST_VENDOR_EMAIL}}
TEST_VENDOR1_EMAIL: ${{secrets.TEST_VENDOR1_EMAIL}}
TEST_BUYER_EMAIL: ${{secrets.TEST_BUYER_EMAIL}}
TEST_SAMPLE_BUYER_EMAIL: ${{secrets.TEST_SAMPLE_BUYER_EMAIL}}
TEST_VENDOR2_EMAIL: ${{secrets.TEST_VENDOR2_EMAIL}}

STRIPE_SECRET_KEY: ${{secrets.STRIPE_SECRET_KEYT}}

jobs:
Expand Down Expand Up @@ -48,4 +56,4 @@ jobs:
- name: Upload coverage report to Coveralls
uses: coverallsapp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
github-token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion src/__test__/auth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,4 @@ describe('User Controller', () => {
await request(app).put('/update-profile').send({});
expect(userProfileUpdateServices).toHaveBeenCalled();
});
});
});
1 change: 1 addition & 0 deletions src/__test__/index.utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { server } from '..';
import { formatMoney, formatDate } from '../utils/index';

describe('Utility Functions', () => {
Expand Down
4 changes: 3 additions & 1 deletion src/__test__/isAllowed.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { User } from '../entities/User';
import { responseError } from '../utils/response.utils';
import { v4 as uuid } from 'uuid';
import { cleanDatabase } from './test-assets/DatabaseCleanup';
import { server } from '..';

jest.mock('../utils/response.utils');

Expand All @@ -19,7 +20,7 @@ const suspendedUserId = uuid();
beforeAll(async () => {
const connection = await dbConnection();

const userRepository = connection?.getRepository(User);
const userRepository = await connection?.getRepository(User);

const activeUser = new User();
activeUser.id = activeUserId;
Expand Down Expand Up @@ -49,6 +50,7 @@ beforeAll(async () => {

afterAll(async () => {
await cleanDatabase();
server.close();
});

describe('Middleware - checkUserStatus', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/__test__/logout.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ describe('POST /user/logout', () => {
expect(res.status).toBe(400);
expect(res.body).toEqual({ Message: 'Access denied. You must be logged in' });
});
});
});
2 changes: 1 addition & 1 deletion src/__test__/product.entities.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,4 +171,4 @@ describe('Product Entity', () => {
expect(savedProduct?.vendor).toBeDefined();
expect(savedProduct?.categories).toBeDefined();
});
});
});
2 changes: 2 additions & 0 deletions src/__test__/roleCheck.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { dbConnection } from '../startups/dbConnection';
import { v4 as uuid } from 'uuid';
import { getConnection } from 'typeorm';
import { cleanDatabase } from './test-assets/DatabaseCleanup';
import { server } from '..';

let reqMock: Partial<Request>;
let resMock: Partial<Response>;
Expand Down Expand Up @@ -36,6 +37,7 @@ beforeAll(async () => {

afterAll(async () => {
await cleanDatabase();
server.close();
});

describe('hasRole MiddleWare Test', () => {
Expand Down
3 changes: 1 addition & 2 deletions src/__test__/user.entity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,5 +270,4 @@ describe('User Entity', () => {
expect(foundUser?.orders.length).toBe(1);
expect(foundUser?.transactions.length).toBe(1);
});
});

});

0 comments on commit 15b8bc5

Please sign in to comment.