routing/tests/index-spec.ts

54 lines
1.9 KiB
TypeScript
Raw Normal View History

import chai from 'chai';
import sinon from 'ts-sinon';
import sinonChai from 'sinon-chai';
2021-05-19 12:55:10 +02:00
chai.use(sinonChai);
2021-05-19 12:55:10 +02:00
const expect = chai.expect;
import { withFile } from 'tmp-promise';
import { writeFileSync } from 'fs';
2021-05-19 12:55:10 +02:00
import { Router } from '../src/index';
import { DiscordParser } from '../src/discordParser';
import { LogWriter } from '../src/logWriter';
import { PeerTubeRequester } from '../src/peertubeRequester';
2021-05-19 12:55:10 +02:00
const well_build_routing_file: Router.GlobalConfig = require('./rsrc/wellBuildedRoutingFile.json');
describe('testing the routing part', function () {
describe('testing the building part', function () {
it('it will test a normal building', async function () {
await withFile(
async (file) => {
const edit_config = {
...well_build_routing_file,
logWriter: {
...well_build_routing_file.logWriter,
...{ path: file.path },
},
};
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 () {});
});
});