Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import test from 'ava';
// import { nearlyEqual } from './helpers/nearlyEqual';
import * as array from '../src/array';
test('import array', t => {
// console.log(
// Object.keys(array)
// .map(k => `test.todo('${k}');`)
// .join('\n')
// );
t.snapshot(Object.keys(array));
});
test.todo('div');
test.todo('addValue');
test.todo('addArray');
test.todo('add');
test.todo('fromxyz');
test.todo('toxyz');
test.todo('first');
test.todo('last');
test.todo('min');
test.todo('range');
t.true(requiredConfig.includes('forum'));
t.true(requiredConfig.includes('apiUrl'));
t.true(requiredConfig.includes('apiKey'));
t.true(requiredConfig.includes('username'));
});
test('required columns', (t) => {
t.is(DiscourseSource.requiredColumns.length, 1);
t.true(DiscourseSource.requiredColumns.includes('target'));
});
test.todo('construction');
test.todo('get thread');
test.todo('add thread');
test.todo('handle thread');
test("Getting message", async (t) => {
const server = await createServer();
const result = await getChatlog({
vodId,
start: 0,
length: 30,
testServer: server.address()
});
t.is(result.length, rechatMessage.comments.length);
t.deepEqual(result, rechatMessage.comments);
await closeServer(server);
});
test.todo("Test getting multiple fragments");
test.todo("Test getting chat messages with start and end");
test.todo("Test getting chat messages with length");
test("Getting all fragments to a vod", async (t) => {
const server = await createServer();
const result = await getChatlog({
vodId,
testServer: server.address()
});
t.is(result.length, rechatMessage.comments.length);
await closeServer(server);
});
test("Error fetching VOD info", async (t) => {
test('get request by url', (t) => {
const q = new RequestQueue();
const i = q.addRequest(req);
t.is(q.getRequestIndex("http://localhost"), i);
q.clear();
});
test('getting a request with an unknown arg', (t) => {
const q = new RequestQueue();
q.addRequest({});
t.is(q.getRequestIndex([]), -1);
q.clear();
});
test.todo("test the promise worker stuff");
referenceUser, notUser
} = t.context;
const exists = await t.context.list.userExists(referenceUser.login);
t.true(exists);
const notExists = await t.context.list.userExists(notUser.login);
t.false(notExists);
});
test("getUsers", async (t) => {
const users = await t.context.list.getUsers();
t.is(users.length, t.context.extraUsers);
t.is(users[0].id, t.context.referenceUser.id);
});
test.todo("getUsersByFavorite");
test("getUsersByFavorite with wrong type", async (t) => {
const { notChannel } = t.context;
await t.throwsAsync(t.context.list.getUsersByFavorite(notChannel));
});
test("getChannelId", async (t) => {
const { referenceChannel } = t.context;
const channelId = await t.context.list.getChannelId(referenceChannel.login);
t.is(channelId, referenceChannel.id);
});
test("getChannel", async (t) => {
const { referenceChannel } = t.context;
const channel = await t.context.list.getChannel(referenceChannel.id);
t.true(channel instanceof Channel);
test('get root dependencies', t => {
rootDependencies = helpers.getRootDependencies();
t.deepEqual(rootDependencies, testData.rootDependencies);
});
test('attach nested dependencies', t => {
flatDependencies = helpers.attachNestedDependencies(rootDependencies);
t.deepEqual(flatDependencies, testData.flatDependencies);
});
test('get all dependencies', t => {
allDependencies = helpers.getAllDependencies(flatDependencies);
t.deepEqual(allDependencies, testData.allDependencies);
});
test.todo('show results');
};
channel.live.redirectTo(channel);
const formattedChannel = await formatChannel(channel, () => undefined);
t.is(formattedChannel.live.state, LiveState.REDIRECT);
t.is(formattedChannel.live.alternateChannel.live.state, LiveState.REBROADCAST);
});
test('formatChannel does not destroy live state creation time', async (t) => {
const channel = getChannel();
channel.title = '[Rerun] title';
const liveSince = channel.live.created;
const formattedChannel = await formatChannel(channel, () => undefined);
t.is(formattedChannel.live.created, liveSince);
});
test.todo('formatChannels without serialization');
test.todo('formatChannels with serialization');
test('filterExistingFavs', (t) => {
const channels = [ getChannel() ],
user = getUser();
user.favorites = channels.map((c) => c.login);
channels.push(getChannel('foo'));
const notExistingFavs = filterExistingFavs(user, channels);
t.is(notExistingFavs.length, 1);
});
[
0, 1, 5, 10, 12, 13,
Math.pow(2, 20),
].forEach((int) => {
t.is(cellToInt(intToCell(int)), int);
});
});
test.todo('loopBelongsToOutput');
test.todo('insideCube');
test.todo('insideCubeMasked');
test.todo('insideLoop');
test.todo('isValidCubeForValuesInMode');
test.todo('appendInput');
test.todo('popInput');
test.todo('renameInput');
test.todo('appendOutput');
test.todo('removeOutput');
test.todo('renameOutput');
test.todo('appendLoop');
test.todo('removeLoop');
test.todo('removeLoopFromOutput');
test.todo('setValue');
test.todo('getValue');
test.todo('newCubeFromTo');
test.todo('newLoop');
test.todo('fromJSON');
test.todo('toJSON');
test.todo('toPLA');
const { client, sandbox } = t.context;
const accessToken = 'access-token';
sandbox.stub(got, 'post', (uri) => {
return Promise.resolve({
body: {
access_token: accessToken
}
});
});
t.is(await client.fetchToken(), accessToken);
});
test.todo('Request includes clientId, clientSecret, and refreshToken');
t.true(result.routeString === 'BCE.GRNPA1.DUBLX');
});
ava.todo('._createLegModelsFromWaypointModels()');
ava.todo('._divideRouteStringIntoSegments()');
ava.todo('._findConvergentWaypointNameWithRouteModel()');
ava.todo('._findIndexOfLegContainingWaypointName()');
ava.todo('._findSidLegIndex()');
ava.todo('._findStarLegIndex()');
ava.todo('._generateLegsFromRouteString()');
ava('._getPastAndPresentLegModels() returns #_previousLegCollection concatenated with #_legCollection', (t) => {
const model = new RouteModel(nightmareRouteStringMock);
model.skipToWaypointName('GUP');
const expectedResult = [
...model._previousLegCollection,
...model._legCollection
];
const result = model._getPastAndPresentLegModels();
t.deepEqual(result, expectedResult);
});
ava('._overwriteRouteBetweenWaypointNames() adjusts divergent/convergent legs and replaces middle content correctly', (t) => {