routing/tests/index-spec.ts

54 lines
1.7 KiB
TypeScript
Raw Normal View History

2021-05-19 12:55:10 +02:00
import chai from "chai";
import sinon from "ts-sinon";
import sinonChai from "sinon-chai";
chai.use(sinonChai)
const expect = chai.expect;
import { withFile } from "tmp-promise"
import { writeFileSync } from "fs";
import { Router } from "../src/index";
2021-05-23 16:07:23 +02:00
import { DiscordParser } from "../src/discordParser";
import { LogWriter } from "../src/logWriter";
import { PeerTubeRequester } from "../src/peertubeRequester";
2021-05-19 12:55:10 +02:00
2021-05-23 16:07:23 +02:00
// const path = require("path");
const well_build_routing_file: Router.GlobalConfig = require("./rsrc/wellBuildedRoutingFile.json");
2021-05-19 12:55:10 +02:00
describe("testing the routing part", function () {
describe("testing the building part", function () {
2021-05-23 16:07:23 +02:00
it("it will test a normal building", async function () {
2021-05-19 12:55:10 +02:00
await withFile(async (file) => {
2021-05-23 16:07:23 +02:00
const edit_config = {
...well_build_routing_file,
logWriter: {
...well_build_routing_file.logWriter,
...{path: file.path}
}
2021-05-19 12:55:10 +02:00
};
2021-05-23 16:07:23 +02:00
const r = new Router(edit_config);
expect(r.api_array['Discord']).to.be.instanceOf(DiscordParser);
expect(r.api_array['logWriter']).to.be.instanceOf(LogWriter);
expect(r.api_array['peertubeRequester']).to.be.instanceOf(PeerTubeRequester);
}, {postfix: '.log'})
})
})
describe("testing the data transmission", function () {
it("it will emit a upload request message", function () {
})
it("it will emit a new listener request", function () {
})
})
describe("testing the data reception", function () {
it("it will received a new entries notification", function() {
2021-05-19 12:55:10 +02:00
})
})
});