Skip to content

Commit

Permalink
Update get_instition.test.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
yunkaa19 committed Apr 30, 2024
1 parent 9556c4d commit 14bd945
Showing 1 changed file with 29 additions and 17 deletions.
46 changes: 29 additions & 17 deletions test/modules/get_institution/app/get_instition.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,43 @@ import { Repository } from '../../../../src/core/repositories/Repository';
import { HttpRequest } from '../../../../src/core/helpers/http/http_codes';
import { InstitutionRepoMock } from '../../../../src/core/repositories/mocks/InstitutionRepoMock';
import { UserRepoMock } from '../../../../src/core/repositories/mocks/UserRepoMock';
import { HttpRequest } from '../../../../src/core/helpers/http/http_codes';

import { UserMock } from '../../../../src/core/structure/mocks/UserMock';

import {TokenAuth} from '../../../../src/core/helpers/functions/token_auth';

describe("Testing Get Institution Presenter", () => {
it("should return institution data", async () => {
const mockUserRepo = new UserRepoMock();
const mockInstitutionRepo = new InstitutionRepoMock();
const mockUserRepo = new UserRepoMock();
const mockInstitutionRepo = new InstitutionRepoMock();


const usecase = new GetInstitutionUsecase(
mockInstitutionRepo, mockUserRepo
);
const controller = new GetInstitutionController(usecase);
const usecase = new GetInstitutionUsecase(
mockInstitutionRepo, mockUserRepo
);
const controller = new GetInstitutionController(usecase);

const mockEvent = {
body: {
property1: "value1",
property2: "value2",
},
const mockAdmin = new UserMock().users[0];


it("should return institution data", async () => {
var token = (await new TokenAuth().generate_token(mockAdmin.id)).toString();
const mockEvent = {
headers: {
Authorization: "Bearer token",
"Content-Type": "application/json",
Authorization:
token,
},
body: JSON.stringify({
id: mockAdmin.id,
name: mockAdmin.name,
email: mockAdmin.email,
user_type: mockAdmin.user_type,
course: mockAdmin.course,
semester_course: mockAdmin.semester_course,
created_at: mockAdmin.created_at,
updated_at: mockAdmin.updated_at
}),
queryStringParameters: {
param1: "value1",
param2: "value2",
id: 1,
},
};

Expand Down

0 comments on commit 14bd945

Please sign in to comment.