test.beforeEach(t => {
test.beforeEach('new PixivApi()', async t => { const pixiv = new PixivApi(); t.context.pixiv = pixiv; const json = await t.context.pixiv.login(username, password); t.true(isObject(json)); });
test.beforeEach(t => { t.context.originalConsoleWarn = console.warn; t.context.consoleWarnings = []; console.warn = v => t.context.consoleWarnings.push(v); });
test.beforeEach('connect and add two post entries', t => { connectDB(t, () => { Post.create(posts, err => { if (err) t.fail('Unable to create posts'); }); }); });
test.beforeEach('start server', t => { const testServer = server.launch(); process.env.BACKEND_URL = `http://localhost:${testServer.address().port}`; t.context.testServer = testServer; });
test.beforeEach(t => { connection.query('TRUNCATE TABLE categories') connection.query('TRUNCATE TABLE products') })
test.beforeEach(t => { clonedBingConfig = _.cloneDeep(bingConfig) clonedNewsConfig = _.cloneDeep(newsConfig) })
test.beforeEach(t => { CLI.__set__('Spike', SpikeMock) cli = new CLI() })
test.beforeEach(async t => { fs.emptyDirSync(config.files); });
/** * Pre-condition for this test is to run on a clean database setup with no records existing */ // Before each test we setup a request object with defaults // Making the request object available to tests through the shared object `t.context` test.beforeEach('Setting up test defaults', t => { const requestObject = request.defaults({ // Set the Base URL for all API requests baseUrl: 'http://localhost:3001', // Set data send/received to be JSON compatible json: true, }); t.context.request = requestObject; });
test.beforeEach(() => { authorizr = new Authorizr(() => { return { foo: 'bar' }; }); });
test.beforeEach(t => { store = mockStore(); });
test.beforeEach(() => { sandbox.stub(console, 'log'); });
test.beforeEach( t => { const context = t.context; context.salesforceUsername = 'mars@example.com'; context.salesforcePassword = 'xxxxx'; });
test.beforeEach(t => inst = new ApplicationInterface());