Archived
1
0
Fork 0

Reorganise test

This commit is contained in:
Ethanell 2020-08-25 17:53:21 +02:00
parent 39b847c79e
commit 43227d42ad
2 changed files with 434 additions and 424 deletions

View file

@ -17,7 +17,7 @@ async function databaseExit(models) {
delete require.cache[require.resolve("../models")];
}
describe("Database objects tests", () => {
describe("Database Department tests", () => {
let models;
@ -60,7 +60,10 @@ describe("Database Sandwich tests", () => {
});
it("Sandwich validation", async () => {
await models.Sandwich.create({name: "TestSandwich", price: 1.5});
return expect(models.Sandwich.create({name: "TestSandwich", price: 1.5})).to.be.rejectedWith(models.Sequelize.ValidationError);
return expect(models.Sandwich.create({
name: "TestSandwich",
price: 1.5
})).to.be.rejectedWith(models.Sequelize.ValidationError);
});
});
@ -94,7 +97,8 @@ describe("Database User test", () => {
email: "test@test.fr",
firstName: "Test",
lastName: "Test",
passwordHash: testPassword});
passwordHash: testPassword
});
expect(testUser.checkPassword(testPassword)).to.be.equal(true);
});
it("User validation", async () => {
@ -203,7 +207,8 @@ describe("Database Order tests", () => {
email: "test@test.fr",
firstName: "Test",
lastName: "Test",
passwordHash: "test"});
passwordHash: "test"
});
await testOrder.setDepartment(testDepartment);
await testOrder.reload();
@ -250,3 +255,4 @@ describe("Database Data tests", () => {
})).to.be.rejectedWith(models.Sequelize.ValidationError);
})
});
});

View file

@ -39,6 +39,7 @@ async function getLoginAgent(app) {
}
describe("Pages tests", () => {
describe("Public pages test", () => {
let app;
let models;
@ -201,6 +202,7 @@ describe("Global logged user pages", () => {
});
});
describe("Permissions pages tests", () => {
for (let [p, a] of Object.entries({
0: [403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403],
1: [200, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403],
@ -275,3 +277,5 @@ for (let [p, a] of Object.entries({
.expect(a[10])
});
});
});
});