MagicMirror/tests/e2e/vendor_spec.js

36 lines
1003 B
JavaScript
Raw Normal View History

const fetch = require("fetch");
2021-09-16 22:36:18 +02:00
const helpers = require("./global-setup");
describe("Vendors", function () {
2021-06-08 00:47:40 +02:00
beforeAll(function () {
2021-09-25 23:45:34 +02:00
helpers.startApplication("tests/configs/default.js");
});
afterAll(async function () {
await helpers.stopApplication();
});
describe("Get list vendors", function () {
2021-02-11 21:22:03 +01:00
const vendors = require(__dirname + "/../../vendor/vendor.js");
2021-06-30 15:22:24 +02:00
Object.keys(vendors).forEach((vendor) => {
it(`should return 200 HTTP code for vendor "${vendor}"`, function (done) {
2021-04-08 21:12:56 +02:00
const urlVendor = "http://localhost:8080/vendor/" + vendors[vendor];
2021-03-02 21:26:25 +01:00
fetch(urlVendor).then((res) => {
2021-06-09 00:19:43 +02:00
expect(res.status).toBe(200);
done();
});
});
});
2017-04-18 23:44:50 -03:00
Object.keys(vendors).forEach((vendor) => {
it(`should return 404 HTTP code for vendor https://localhost/"${vendor}"`, function (done) {
2021-04-08 21:12:56 +02:00
const urlVendor = "http://localhost:8080/" + vendors[vendor];
2021-03-02 21:26:25 +01:00
fetch(urlVendor).then((res) => {
2021-06-09 00:19:43 +02:00
expect(res.status).toBe(404);
done();
2017-04-18 23:44:50 -03:00
});
});
});
});
});