2017-07-24 22:08:12 +02:00
|
|
|
const helpers = require("./global-setup");
|
2021-03-02 21:26:25 +01:00
|
|
|
const fetch = require("node-fetch");
|
2017-07-24 22:08:12 +02:00
|
|
|
const expect = require("chai").expect;
|
2017-03-18 12:40:07 -03:00
|
|
|
|
2017-07-24 22:08:12 +02:00
|
|
|
const describe = global.describe;
|
|
|
|
const it = global.it;
|
2017-07-25 20:20:51 -04:00
|
|
|
const before = global.before;
|
|
|
|
const after = global.after;
|
2017-03-18 12:40:07 -03:00
|
|
|
|
|
|
|
describe("Vendors", function () {
|
2017-07-24 22:08:12 +02:00
|
|
|
helpers.setupTimeout(this);
|
2017-03-18 12:40:07 -03:00
|
|
|
|
2017-07-24 22:08:12 +02:00
|
|
|
var app = null;
|
2017-07-20 00:25:10 -04:00
|
|
|
|
2017-07-25 20:20:51 -04:00
|
|
|
before(function () {
|
2020-01-19 04:06:21 -03:00
|
|
|
process.env.MM_CONFIG_FILE = "tests/configs/env.js";
|
2020-05-11 22:22:32 +02:00
|
|
|
return helpers
|
|
|
|
.startApplication({
|
|
|
|
args: ["js/electron.js"]
|
|
|
|
})
|
|
|
|
.then(function (startedApp) {
|
|
|
|
app = startedApp;
|
|
|
|
});
|
2017-03-18 12:40:07 -03:00
|
|
|
});
|
|
|
|
|
2017-07-25 20:20:51 -04:00
|
|
|
after(function () {
|
2017-07-24 22:08:12 +02:00
|
|
|
return helpers.stopApplication(app);
|
2017-03-18 12:40:07 -03:00
|
|
|
});
|
|
|
|
|
|
|
|
describe("Get list vendors", function () {
|
2021-02-11 21:22:03 +01:00
|
|
|
const vendors = require(__dirname + "/../../vendor/vendor.js");
|
2020-05-11 22:22:32 +02:00
|
|
|
Object.keys(vendors).forEach((vendor) => {
|
2017-07-24 22:08:12 +02:00
|
|
|
it(`should return 200 HTTP code for vendor "${vendor}"`, function () {
|
2020-05-02 10:39:09 +02:00
|
|
|
var urlVendor = "http://localhost:8080/vendor/" + vendors[vendor];
|
2021-03-02 21:26:25 +01:00
|
|
|
fetch(urlVendor).then((res) => {
|
|
|
|
expect(res.status).to.equal(200);
|
2017-03-18 12:40:07 -03:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2017-04-18 23:44:50 -03:00
|
|
|
|
2020-05-11 22:22:32 +02:00
|
|
|
Object.keys(vendors).forEach((vendor) => {
|
|
|
|
it(`should return 404 HTTP code for vendor https://localhost/"${vendor}"`, function () {
|
2020-05-02 10:39:09 +02:00
|
|
|
var urlVendor = "http://localhost:8080/" + vendors[vendor];
|
2021-03-02 21:26:25 +01:00
|
|
|
fetch(urlVendor).then((res) => {
|
|
|
|
expect(res.status).to.equal(404);
|
2017-04-18 23:44:50 -03:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2017-03-18 12:40:07 -03:00
|
|
|
});
|
|
|
|
});
|