Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import fs from 'fs';
import test from 'ava';
import shell from '..';
import utils from './utils/utils';
const CWD = process.cwd();
const numLines = utils.numLines;
test.beforeEach(t => {
t.context.tmp = utils.getTempDir();
shell.config.silent = true;
shell.cp('-r', 'resources', t.context.tmp);
shell.cd(t.context.tmp);
});
test.afterEach.always(t => {
process.chdir(CWD);
shell.rm('-rf', t.context.tmp);
});
//
// Invalids
//
let deployed;
let version;
let manager;
let deployer;
const fundNames = [web3.utils.padLeft(web3.utils.toHex('Fund Name 1'), 34), web3.utils.padLeft(web3.utils.toHex('Fund Name 2'), 34),];
test.before(async () => {
deployed = await deployEnvironment(environment);
accounts = await web3.eth.getAccounts();
[deployer, manager] = accounts;
version = deployed.Version;
fundRanking = deployed.FundRanking;
});
test.beforeEach(async () => {
// Fund Setup 1
let [r, s, v] = await getTermsSignatureParameters(manager);
await version.methods.setupFund(
fundNames[0], // name of the fund
deployed.MlnToken.options.address, // reference asset
config.protocol.fund.managementFee,
config.protocol.fund.performanceFee,
deployed.NoCompliance.options.address,
deployed.RMMakeOrders.options.address,
[deployed.MatchingMarket.options.address],
[],
v,
r,
s,
).send({ from: manager, gas: config.gas, gasPrice: config.gasPrice });
import test from 'ava';
import chalk from 'chalk';
import * as sinon from 'sinon';
import * as proxyquire from 'proxyquire';
import * as table from 'text-table';
const logging = { log() { } };
proxyquire('../../../src/lib/formatters/stylish/stylish', { '../../utils/logging': logging });
import stylish from '../../../src/lib/formatters/stylish/stylish';
import * as problems from './fixtures/list-of-problems';
test.beforeEach((t) => {
sinon.spy(logging, 'log');
t.context.logger = logging;
});
test.afterEach.always((t) => {
t.context.logger.log.restore();
});
test(`Stylish formatter doesn't print anything if no values`, (t) => {
stylish.format(problems.noproblems);
t.is(t.context.logger.log.callCount, 0);
});
test(`Stylish formatter prints a table and a summary for each resource`, (t) => {
import test from 'ava';
import path from 'path';
import mix from '../src/index';
import WebpackConfig from '../src/builder/WebpackConfig';
import defaultConfig from '../src/config';
import ComponentFactory from '../src/components/ComponentFactory';
test.beforeEach(t => {
Config = defaultConfig();
global.Mix = new (require('../src/Mix'))();
Config.publicPath = 'public';
new ComponentFactory().installAll();
});
test('basic JS compilation config.', t => {
mix.js('resources/assets/js/app.js', 'public/js');
Mix.dispatch('init');
let webpackConfig = new WebpackConfig().build();
import test from 'ava'
import { response } from '../helpers/context'
test.beforeEach(async t => {
t.context = await response()
})
test('res.remove(name) should remove a field', t => {
const res = t.context
res.set('x-foo', 'bar')
res.remove('x-foo')
t.deepEqual(res.header, {})
})
import mockery from 'mockery'
import test from 'ava'
import os from 'os'
const IS_WIN = os.platform().match(/^win/)
test.before(() => {
mockery.enable({
warnOnReplace: false,
warnOnUnregistered: false,
useCleanCache: true
})
})
test.beforeEach(() => {
mockery.resetCache()
})
test.after(() => {
mockery.disable()
})
test('procfile stat', async t => {
if (IS_WIN) {
t.pass()
return
}
var fs = require('fs')
var openCalled = 0
import test from 'ava';
import withComponent from 'ava-webcomponents';
import * as superfine from 'https://cdn.jsdelivr.net/npm/superfine@6.0.1/src/index.js';
import { spy, stub, match } from 'sinon';
import defaultProps from '../../../../tests/helpers/default-props.js';
import { create, render } from '../../../index.js';
import html from '../index.js';
import * as u from '../utils.js';
test.beforeEach(t => {
t.context.viewSpy = spy(() => superfine.h('div'));
t.context.patchStub = stub(superfine, 'patch');
t.context.recycleStub = stub(superfine, 'recycle');
});
test.afterEach(t => {
t.context.patchStub.restore();
t.context.recycleStub.restore();
});
test.serial('It should only patch the tree when the node is connected to the DOM;', async t => {
const assertions = [{ isConnected: true, callCount: 1 }, { isConnected: false, callCount: 0 }];
for (const assertion of assertions) {
const { isConnected, callCount } = assertion;
const m = html(t.context.viewSpy);
import test from 'ava';
import sinon from 'sinon';
import { Readable } from 'stream';
import spigot from 'stream-spigot';
import get from 'through2-get';
import getStream from 'get-stream';
import transclude from '../../src/transclude';
import * as parse from '../../src/parse';
import * as pegjs from '../../src/grammar';
test.beforeEach(t => {
t.context.sandbox = sinon.sandbox.create();
});
test.afterEach(t => {
t.context.sandbox.restore();
});
test.cb('should pass through objects unmodified', t => {
const input = [{ content: 'Hello world!' }];
const testStream = transclude();
spigot({ objectMode: true }, input).pipe(testStream);
getStream
.array(testStream)
.then(output => {
import test from 'ava'
import getAbility from '../getAbility'
import { Action } from '../../../services/abilities/ability.constants'
import { Role } from '../../../services/auth/role'
test.beforeEach(t => {
t.context.DEFAULT_REQ = {
session: {
isAuthenticated: true,
user: {},
me: {
role: []
}
}
}
})
const mockNext = () => { }
test.serial('Get ability for anonymous user when no session found', async t => {
const req = {}
const res = {}
getAbility({ searchPattern: '/server/middleware/ability/__tests__/getAbility.foo.fixture.js' })(req, res, mockNext)
import ava from 'ava';
import sinon from 'sinon';
import WaypointModel from '../../../src/assets/scripts/client/aircraft/FlightManagementSystem/WaypointModel';
import StaticPositionModel from '../../../src/assets/scripts/client/base/StaticPositionModel';
import {
createNavigationLibraryFixture,
resetNavigationLibraryFixture
} from '../../fixtures/navigationLibraryFixtures';
import { INVALID_NUMBER } from '../../../src/assets/scripts/client/constants/globalConstants';
import { DEFAULT_HOLD_PARAMETERS } from '../../../src/assets/scripts/client/constants/waypointConstants';
let sandbox;
ava.beforeEach(() => {
sandbox = sinon.sandbox.create();
createNavigationLibraryFixture();
});
ava.afterEach(() => {
sandbox.restore();
resetNavigationLibraryFixture();
});
ava('throws when instantiated without parameters', (t) => {
t.throws(() => new WaypointModel());
});
ava('throws when instantiated with string containing unknown fix', (t) => {
t.throws(() => new WaypointModel('INVALIDFIXNAME'));
});