Skip to content
Snippets Groups Projects
Commit c4389763 authored by Muhammad Rafi Haidar's avatar Muhammad Rafi Haidar
Browse files

test: maintenance final

parent 7bc027ee
Branches uc-staff-manage-maintenance
Tags
3 merge requests!52Release,!51Release,!45Maintenance test final
......@@ -55,7 +55,7 @@ function AdminUser() {
</nav>
</div>
<div className="container pt-20">
<div className="flex justify-center mb-8">
<div className="flex justify-center mb-8 pt-10">
<button
className="bg-blue-500 hover:bg-blue-700 text-white font-bold py-3 px-60 rounded"
onClick={toggleAddUser}
......
......@@ -38,6 +38,7 @@ beforeAll( async()=> { // Digunain buat ngisi database-nya dengan data dummy
phone : "888888888888"
},
});
await prisma.room.create({
data: { // Body dari data
id: 10,
......@@ -45,18 +46,37 @@ beforeAll( async()=> { // Digunain buat ngisi database-nya dengan data dummy
},
});
await prisma.room.create({
data: { // Body dari data
id: 20,
is_flagged: false
},
});
await prisma.maintenance.create({
data: { // Body dari data
id: 200,
staff_id: 500,
room_id: 10,
description: "test"
description: "test",
status: "pending"
},
});
await prisma.maintenance.create({
data: { // Body dari data
id: 300,
staff_id: 500,
room_id: 20,
description: "test",
status: 'in_progress'
},
});
await prisma.report.create({
data: { // Body dari data
id: 25,
maintenance_id: 300,
description: "test"
},
});
......@@ -104,23 +124,11 @@ describe("Test the maintenance path", () => {
describe("Test the maintenance path", () => {
test("It should response the GET method", async () => {
const response = await request(app)
.get(`/staff/500`);
.get(`/maintenance/staff/500`);
expect(response.statusCode).toBe(200);
});
});
// PASS
describe("Test the maintenance path", () => {
test("It should update the maintenance status to 'in_progress'", async () => {
const response = await request(app)
.put(`/maintenance/200`)
.send({
status: "in_progress"
});
expect(response.statusCode).toBe(200);
});
});
// PASS
describe("Test the root path", () => {
test("It should response the POST method", async () => {
......@@ -135,19 +143,26 @@ describe("Test the root path", () => {
});
});
describe("Test the /report path", () => {
test("It should response the POST method", () => {
return request(app)
.get("/report")
.then(response => {
expect(response.statusCode).toBe(200);
});
// PASS
describe("Test the maintenance path", () => {
test("It should update the maintenance status to 'finished'", async () => {
const response = await request(app)
.put(`/maintenance/300`)
.send({
status: "finished"
});
expect(response.statusCode).toBe(200);
});
});
// PASS
describe("Test the maintenance path", () => {
test("It should update the maintenance status to 'in_progress'", async () => {
const response = await request(app)
.put(`/maintenance/200`)
.send({
status: "in_progress"
});
expect(response.statusCode).toBe(200);
});
});
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment