routing/tests/index-spec.ts

54 lines
1.9 KiB
TypeScript

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';
import { DiscordParser } from '../src/discordParser';
import { LogWriter } from '../src/logWriter';
import { PeerTubeRequester } from '../src/peertubeRequester';
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 () {});
});
});