Skip to content

Commit

Permalink
adicionando testes de atualização de profissional #87
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuelSSan28 committed Jun 24, 2021
1 parent 21299cc commit a0edc98
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions backend/__tests__/Professional.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { createConnection, getConnection, getRepository } from "typeorm";
import { Client } from "../src/entities/Client";
import { Professional } from "../src/entities/Professional";
import { User } from "../src/entities/User";
import { ProfessionalService } from "../src/services/ProfessionalService";
import { UserService } from "../src/services/UserService";


Expand Down Expand Up @@ -45,3 +46,41 @@ test("store a Professional and fetch it", async () => {

expect(joe.name).toBe("Joe");
});


test("store a Client and update it", async () => {

const newProfessional = {
name: "Joe",
email:"joe2@gmail.com",
speciality:"psicologia forense",
crm_crp:"071.122.811-79",
password:"joepsicologia",
type:1
}


const userService = new UserService();

await userService.createUser(newProfessional);


let joe = await getRepository(Professional).findOne({
where: {
crm_crp:"071.122.811-79"
}
});

const professionalService = new ProfessionalService();

await professionalService.update({id:joe.id, name:"Joe Atualizado",});

let joe2 = await getRepository(Professional).findOne({
where: {
id:joe.id
}
});


expect(joe2.name).toBe("Joe Atualizado");
});

0 comments on commit a0edc98

Please sign in to comment.