feature: 'notes', enabled: true, optin: false
  },
  mentor: {
    feature: 'mentor', enabled: false, optin: true
  }
}

/* ======================================================

                    DECLARATIVE

    Use your knowledge from the previous challenge
    to create a few functions from the toolkit above.
    Try to do one one step at a time then use pipe
    to compose the functions together. Maybe even try
    creating a few piped functions and compose a
    composition

====================================================== */


test.skip('Declarative 1', t => {
  const f = declarativeTransformer(
    ['id', 'isEnabledForUser', 'isAvailableForOptIn'],
    ['feature', 'enabled', 'optin'],
    'feature'
  )
  let result = f(input)
  t.deepEqual(result, expected)
})
test.cb.serial('performs a query with a limit', function (t) {
  query.testLimit(t.end);
});

test.cb.serial.skip('allows manual pagination through results', function (t) {
  entity.testBatchUpsert(function (err) {
    t.ifError(err);
    setTimeout(function () {
      query.testCursorPaging(t.end);
    }, 1000);
  });
});

test.skip('performs an ancestor query', function (t) {
  query.testEventualConsistentQuery(t.end);
});

// Entities

test.cb.serial('saves with an incomplete key', function (t) {
  entity.testIncompleteKey(t.end);
});

test.cb.serial('saves with a named key', function (t) {
  entity.testNamedKey(t.end);
});

test.cb.serial('saves a key with a parent', function (t) {
  entity.testKeyWithParent(t.end);
});
test('#removeFirstIn: remove the first item and return it', (t) => {
  const collection = new Fifo();
  collection.set('1', 'A');
  collection.set('2', 'B');
  collection.set('3', 'C');
  collection.set('4', 'D');

  t.is(collection.keys().length, 4);

  const removed = collection.removeFirstIn();
  t.is(collection.keys().length, 3);
  t.deepEqual(removed, { key: '1', value: 'A' });
});

test.skip('#removeFirstIn: does not leak', (t) => {
  t.notThrows(() => {
    iterate(() => {
      const collection = new Fifo();
      collection.set('1', 'A');
      collection.set('2', 'B');
      collection.set('3', 'C');
      collection.set('4', 'D');

      t.is(collection.keys().length, 4);

      collection.removeFirstIn();
    });
  });
});
test.skip('Review: JavaScript has `for in` loops', t => {
  // ES5 defined `for in` loops to iterate through property names

  // It works on arrays...

  let array_result = [];
  for (let i in ['foo', 'bar', 'baz']) {
    array_result.push(i);
  }

  t.deepEqual(array_result, __); // <-- What is the result?

  // Strings can be accessed like Arrays, so maybe you can use them, too?

  let s = 'hello';
  t.is(s[1], 'e');

  let str_result = [];
  for (let x in s) {
    str_result.push(x);
  }

  t.deepEqual(str_result, __); // <-- What is the result?

  // It works on objects, too.
  
  let obj_result = [];
  for (let p in {x: 'Foo', y: 'Bar', z: 'Baz' }) {
    obj_result.push(p);
  }

  t.deepEqual(obj_result, __); // <-- What is the result?
});
Beispiel #5
0
//所有文件只会运行这个,胡说!因为用了match,它的优先极高
test.only('woo', t => {
    console.log(33)
    t.pass();
});

test.todo('will think about writing this lateroo');

test.failing('demonstrate some bugoo', t => {
    console.log(44)
    t.fail(); // test will count as passed
});

test.skip('will not be runoo', t => {
    console.log(44)
    t.fail();
});


test.before('before1', t => {
    // 这个会在本文件的所有测试前运行
    console.log(0)
    return Promise.resolve('b1');
});

test.before(async t => {
    console.log(0.1)
    await Promise.resolve('b2');
    // 这个会在上面的方法后面运行,但在测试之前运行

});
});

ava('.createSchedulesFromList() calls aircraftController.createPreSpawnAircraftWithSpawnPatternModel() if preSpawnAircraftList has items', (t) => {
    SpawnScheduler.init(aircraftControllerStub);
    SpawnScheduler.createSchedulesFromList();

    t.true(aircraftControllerStub.createPreSpawnAircraftWithSpawnPatternModel.called);
});

ava.skip('.createNextSchedule() calls GameController.game_timeout()', (t) => {
    const gameControllerGameTimeoutStub = {
        game_timeout: sandbox.stub(),
        game: {
            time: 0
        }
    };
    SpawnScheduler.init(aircraftControllerStub);
    const spawnPatternModel = SpawnPatternCollection._items[0];

    SpawnScheduler.createNextSchedule(spawnPatternModel, aircraftControllerStub);

    t.true(gameControllerGameTimeoutStub.game_timeout.called);
});

ava('.createAircraftAndRegisterNextTimeout() calls aircraftController.createAircraftWithSpawnPatternModel()', (t) => {
    SpawnScheduler.init(aircraftControllerStub);
    const spawnPatternModel = SpawnPatternCollection._items[0];

    SpawnScheduler.createAircraftAndRegisterNextTimeout([spawnPatternModel, aircraftControllerStub]);

    t.true(aircraftControllerStub.createAircraftWithSpawnPatternModel.called);
});
var test = require("ava");
var expect = require("expect");
var total_characters = require('./count_characters.js');


test('Test for words', t => {
  expect(total_characters(['adios', 'bye', 'ciao'])).toEqual(12);
});

test('Test for array of numbers', t => {
  expect(total_characters([4, 5, 6])).toEqual(0);
});

test('Test for empty array', t => {
  expect(total_characters([])).toEqual(0);
});

test('Test for array of length 1', t => {
  expect(total_characters(['brianlusinaombito'])).toEqual(17);
});

test('Test for different types of variables', t => {
  expect(total_characters(['Brian', 5, {}, 'lusina'])).toEqual(11);
});

// TODO: toThrow not working for some reason
test.skip('Test for wrong arguments', t => {
  expect(total_characters(9)).toThrow(new TypeError('Invalid parameter 9'));
});
Beispiel #8
0
const env = Object.create(process.env);
env.FORK = true;

const fn = initDir => child_process.fork('../cli.js', [initDir], { env });

test.cb('.find() accepts existing dir path', t => {
  const dd = fn(__dirname);

  dd.on('message', m => {
    t.is(m, true);
    t.end();
  })
})

test.cb('.find() rejects non-existing dir path', t => {
  const dd = fn(path.join(__dirname, 'x'));

  dd.on('message', m => {
    t.is(m, false);
    t.end();
  })
})

test.skip('dominant.sum is largest aggregated file size sum at .exit()', t => {
  const dd = fn(__dirname);

  dd.on('close', code => {
    
  })
})
import test from 'ava'

import adjacentStyle from '../../../../src/content/expander/lib/adjacentStyle'

test.skip(t => {
  const div = document.createElement('div')
  document.body.appendChild(div)

  const style = adjacentStyle(div)

  t.is(style.left, undefined)
  t.is(style.top, undefined)
})
Beispiel #10
0
import test from 'ava';

test.skip('ES7 defines an exponentiation operator', t => {
  t.is(3 ** 2, __);
});

test.skip('ES7 defines an exponentiation operator', t => {
  t.true(['foo', 'bar', 'baz'].includes(__));
});

// ============================================================================

// REVIEW:
// - The entirety of ES7 / ES2016 fits in a tweet: `x ** y` and `[].includes`.
import test from 'ava';
import MacroContext from '../src/macro-context';
import Syntax from '../src/syntax';
import { makeEnforester } from './assertions';
import { List } from 'immutable';

test.skip('a macro context should have a name', t => {
  let enf = makeEnforester('a');
  let ctx = new MacroContext(enf, Syntax.fromIdentifier('foo'), {});
  t.true(ctx.name().val() === 'foo');
});

test('a macro context should be resettable', t => {
  let enf = makeEnforester('a b c');
  let ctx = new MacroContext(enf, 'foo', enf.context);
  const val = v => v.val();

  let [a1, b1, c1] = [...ctx].map(val);
  t.true(ctx.next().done);

  ctx.reset();

  let nxt = ctx.next();
  t.false(nxt.done);

  let [a2, b2, c2] = [nxt.value, ...ctx].map(val);
  t.true(a1 === a2);
  t.true(b1 === b2);
  t.true(c1 === c2);
});
});

ava('.getActiveRunwayForCategory() returns the correct RunwayModel for departure', (t) => {
    const model = new AirportModel(AIRPORT_JSON_KLAS_MOCK);
    const result = model.getActiveRunwayForCategory(FLIGHT_CATEGORY.DEPARTURE);

    t.true(result.name === model.departureRunwayModel.name);
});

ava('.getActiveRunwayForCategory() returns the correct RunwayModel for arrival', (t) => {
    const model = new AirportModel(AIRPORT_JSON_KLAS_MOCK);
    const result = model.getActiveRunwayForCategory(FLIGHT_CATEGORY.ARRIVAL);

    t.true(result.name === model.arrivalRunwayModel.name);
});

ava('.getActiveRunwayForCategory() returns the arrivalRunway when an invalid category is passed', (t) => {
    const model = new AirportModel(AIRPORT_JSON_KLAS_MOCK);
    const result = model.getActiveRunwayForCategory('threeve');

    t.true(result.name === model.arrivalRunwayModel.name);
});

ava.skip('.removeAircraftFromAllRunwayQueues()', (t) => {
    const model = new AirportModel(AIRPORT_JSON_KLAS_MOCK);
    const removeAircraftFromAllRunwayQueuesSpy = sinon.spy(model._runwayCollection, 'removeAircraftFromAllRunwayQueues');
    model.removeAircraftFromAllRunwayQueues({});

    t.true(removeAircraftFromAllRunwayQueuesSpy.calledOnce);
});
Beispiel #13
0
test.after('clean', t => {
    server && server.close();
});

test.skip('it should show error page correctly', async t => {
// test.serial('it should show error page correctly', async t => {
    await core.init('development', true);

    // switch to SPA mode
    // core.config.build.ssr = false;
    // syncConfig(core, core.config);

    await core.build();

    // set middlewares & start a server
    // app.use(isKoaSupport ? core.koaMiddleware() : core.expressMiddleware());
    app.use(core.expressMiddleware());
    server = app.listen(port);

    // serve main.html
    // let skeletonContent = `<div data-server-rendered=true class=skeleton-wrapper`
    res = await request(app)
        // .get('/index.html');
        .get('/some-page-not-exists');
    t.is(404, res.status);
    // t.is('what?', res.text);
    // include skeleton
    // t.true(res.text.indexOf(skeletonContent) > -1);
});
Beispiel #14
0
ava('#deltaTime returns a max value of 100', (t) => {
    TimeKeeper._frameDeltaTime = 33;
    TimeKeeper._simulationRate = 10;

    t.true(TimeKeeper.deltaTime === 100);
});

ava.skip('#accumulatedDeltaTime is the sum of each deltaTime value from instantiation to now', (t) => {
    const deltaValues = [];

    deltaValues.push(TimeKeeper.deltaTime);

    TimeKeeper.update();
    deltaValues.push(TimeKeeper.deltaTime);

    TimeKeeper.update();
    deltaValues.push(TimeKeeper.deltaTime);

    TimeKeeper.update();
    deltaValues.push(TimeKeeper.deltaTime);

    const sum = deltaValues.reduce((accumulator, item) => accumulator + item, 0);

    t.true(sum === TimeKeeper.accumulatedDeltaTime);
});

ava.skip('#accumulatedDeltaTime is the sum of each deltaTime value from instantiation to now offset by timewarp', (t) => {
    const deltaValues = [];

    deltaValues.push(TimeKeeper.deltaTime);

    TimeKeeper.update();
Beispiel #15
0
test('fix option', async t => {
	const filepath = await tempWrite('console.log(0)\n', 'x.js');
	await execa('../cli.js', ['--no-local', '--fix', filepath]);
	t.is(fs.readFileSync(filepath, 'utf8').trim(), 'console.log(0);');
});

test('reporter option', async t => {
	const filepath = await tempWrite('console.log()\n', 'x.js');

	try {
		await execa('../cli.js', ['--no-local', '--reporter=compact', filepath]);
	} catch (err) {
		t.true(err.stdout.indexOf('Error - ') !== -1);
	}
});

test('overrides fixture', async () => {
	const cwd = path.join(__dirname, 'fixtures/overrides');
	await execa('../../../cli.js', ['--no-local'], {cwd});
});

test.skip('ignores fixture', async t => { // eslint-disable-line
	const cwd = path.join(__dirname, 'fixtures/ignores');
	t.throws(execa('../../../cli.js', ['--no-local'], {cwd}));
});

test('supports being extended with a shareable config', async () => {
	const cwd = path.join(__dirname, 'fixtures/project');
	await execa('../../../cli.js', ['--no-local'], {cwd});
});
Beispiel #16
0
// import path from 'path'
import test from 'ava'
import mockfs from 'mock-fs'
import fs from 'mz/fs'
import { map, sortBy } from 'lodash'
import createFiles from '../src/cli'
import letsago from '../src/letsago'
// import mockfsHelper from './helpers/mock-fs-helper'

test.skip('create files', async t => {
  const files = letsago()
  mockfs({})
  createFiles(files)
  const result = await fs.readdir('.')
  mockfs.restore()
  t.deepEqual(sortBy(result), sortBy(map(files, f => f.name)))
})
import test from 'ava';

test.skip('`=>` is shorthand for a function', t => {
  // ES2015 introduces `=>` as a shorthand for creating functions.

  let greet = function(who) { return 'Hello, ' + who; }
  t.is(greet('world'), 'Hello, world');

  // TODO: Fill in the blanks
  let bye = (__) => { return ___; }
  t.is(bye('world'), 'Goodbye, world');
});

test.skip('`=>` without `{}` implicitly returns', t => {
  // If you omit the `{ }` braces, arrow functions implicitly return results.

  let greet = (who) => 'Hello, ' + who;
  t.is(greet('world'), 'Hello, world');

  // TODO: Fill in the blanks
  let bye = (__) => ___;
  t.is(bye('world'), 'Hello, world');
});

test.skip('Exercise: Re-writing a filter chain', t => {
  // Generated with https://github.com/marak/faker.js <-- Super neat project
  let inventory = [
    { product: "Table", material: "Metal",    price: 61.64, qty: 3 },
    { product: "Table", material: "Granite",  price: 96.54, qty: 7 },
    { product: "Table", material: "Steel",    price: 49.83, qty: 4 },
    { product: "Table", material: "Plastic",  price: 90.49, qty: 5 },
Beispiel #18
0
'use strict'

const test = require('ava')
// Const ConnectionResolve = require('../resolve/lib/Connection')

test.skip('socketParameters()', () => {
  // t.is(ConnectionResolve.prototype.socketParameters('xmpps://foo'), undefined)
  // t.is(ConnectionResolve.prototype.socketParameters('xmpp://foo'), undefined)
  // t.is(ConnectionResolve.prototype.socketParameters('ws://foo'), undefined)
  // t.is(ConnectionResolve.prototype.socketParameters('wss://foo'), undefined)
  // t.is(ConnectionResolve.prototype.socketParameters('foo'), 'foo')
  // t.is(ConnectionResolve.prototype.socketParameters('foo.bar'), 'foo.bar')
})
Beispiel #19
0
  return Promise.all([
    promise(conn, 'connecting'),
    promise(conn, 'status').then(status => {
      t.is(status, 'connecting')
    }),
    conn.connect('url'),
  ])
})

test.skip('rejects if an error is emitted before connected', t => {
  const conn = new Connection()
  const error = new Error('foobar')

  conn.Socket = socket(function() {
    this.emit('error', error)
  })
  const promise = conn.connect('url')
  return promise.catch(err => {
    t.is(err, error)
  })
})

test('resolves if socket connects', t => {
  const conn = new Connection()
  conn.Socket = socket(function() {
    this.emit('connect')
  })

  return conn.connect('url').then(() => {
    t.pass()
  })
Beispiel #20
0
import test from 'ava';

test.skip('Review: prototypes as classes', t => {
  // JavaScript has always had prototypal inheritance, which looks like classes.
  function Greeter(who) {
    this.who = who;
  }

  Greeter.prototype.hello = function() { return `Hello, ${this.who}`; };

  Greeter.prototype.bye = function() { return `Goodbye, ${this.who}`; };

  let world = new Greeter('world');
  t.is(world.hello(), 'Hello, world');
  t.is(world.bye(), 'Goodbye, world');

  let mwc = new Greeter('MinneWebCon');
  t.is(mwc.hello(), 'Hello, MinneWebCon');

  // Changing the prototype changes all of its instances
  // (They were all just referencing the value on the prototype...)

  Greeter.prototype.hello = function() { return `Hi, ${this.who}`; };

  t.is(world.hello(), __);
  t.is(mwc.hello(), __);

  t.true(mwc instanceof Greeter);
});

test.skip('There is a new `class` definition syntax', t => {
test.skip('Functions can have default arguments', t => {
  // We used to have to explicitly check for undefined:

  function foo(arr, sep) {
    if (sep === undefined) {
      sep = ', ';
    }

    return arr.join(sep);
  }

  t.is(foo(['a', 'b', 'c']), "a, b, c");
  t.is(foo(['a', 'b', 'c'], "|"), "a|b|c");

  // But now we can set defaults right in the function definition:

  function bar(arr, sep = ', ') {
    return arr.join(sep);
  }

  t.is(bar(['a', 'b', 'c']), "a, b, c");
  t.is(bar(['a', 'b', 'c'], "|"), "a|b|c");

  // TODO: Write a function, greet, which returns the strings below:
  function greet(___) {
    return `__`;
  }

  // Passing specific parameters works
  t.is(greet('you'), 'Hello, you!');
  t.is(greet('world'), 'Hello, world!');

  // Omitting a parameter or passing `undefined` uses the default value
  t.is(greet(), 'Hello, world!');
  t.is(greet(undefined), 'Hello, world!');
});
process.chdir(path.resolve(process.cwd() + '/test'));
const pwd = path.resolve(process.cwd(), '..');

const read = path => new Promise((resolve, reject) => {
	readFile(path, 'utf8', (err, data) => {
		if (err) {
			reject(err);
		}
		return resolve(data);
	});
});

test('post-load-pliguns default config for postcss from package.json', async t => {
	t.is(
		'.test{display:-webkit-box;display:-ms-flexbox;display:flex;color:red}',
		(await postcss(postLoadPlugins({pwd})).process('.test { display: flex; color: #ff0000;} @charset "utf-8";', {map: false})).css
	);
});

/* eslint ava/no-skip-test: off */
test.skip('post-load-pliguns default config for postcss-cli from package.json', async t => {
	t.plan(2);
	const filename = tempfile('.css');
	await execa('postcss', ['-u', path.resolve('../lib/index.js'), '-o', filename, 'test/fixtures/input-for-cli.css', '--no-map']);
	const fix = await read('test/expected/output-for-cli.css');
	const exp = await read(filename);
	t.true(existsSync(filename));
	t.is(fix, exp);
});
Beispiel #23
0
    limitReached = true;
    [removedItem] = items;
    collection.set('fixed-key', n1m, fixedKeyOnLimit);
  };

  while (!(limitReached || i === 100)) {
    i += 1;
    key = `test:${i}`;
    collection.set(key, n100k, fifoQueueOnLimit);
  }

  t.is(collection.get('fixed-key').length, n1m.length);
  removedItem.key.should.equal('test:1');

  // These tests crash IE8, IE9, IE10
  if (navigator.appVersion.indexOf('MSIE 8') === -1 || navigator.appVersion.indexOf('MSIE 9') === -1 || navigator.appVersion.indexOf('MSIE 10') === -1) {
    return;
  }

  removedItemForFixedKey.key.should.equal('test:2');
  removedItemForFifo.key.should.equal('test:12');
});

test.skip('does not leak', (t) => {
  t.notThrows(() => {
    iterate(() => {
      collection = new Fifo({ namespace: 'fifo:test' });
    });
  });
});
import { Request } from 'alexa-annotations';

test('LaunchRequest', t => {
  const event = Request.launchRequest().build();

  return Skill(event).then(response => {
    t.deepEqual(response, {
      version: '1.0',
      response: {
        shouldEndSession: true,
        outputSpeech: { type: 'PlainText', text: 'Space launched!' }
      }
    });
  });
});

test.skip('Sound intent', t => {
  const event = Request.intent('sound').build();

  return Skill(event).then(response => {
    t.deepEqual(response, {
      version: '1.0',
      response: {
        shouldEndSession: true,
        outputSpeech: { type: 'PlainText', text: 'Hello world' },
        card: { type: 'Simple', title: 'Space', content: 'Hello world' }
      }
    });
  });
});
Beispiel #25
0
    throw new Error(`Some lame error!`);
  };

  let gen = await t.context.storm.step();

  t.true(gen[0].result instanceof Error);
  t.false(gen[0].success);
  t.is(gen[0].score, 0);
});

// Stream based tests...

test.skip('Storm<Stream> run should accept return values', t => {

  return toArray(t.context.storm).then(results => {
    t.true(results instanceof Array);
    t.is(results.length, EXPECTED_RESULT_COUNT);
  });
});

test.skip('Storm<Stream> run should accept promises', t => {
  
  t.context.storm.run = (params) => {
    return new Promise((resolve, reject) => {
      setTimeout(() => {
        resolve((params.a * params.b) / params.c);
      }, DELAY);
    });
  };

  return toArray(t.context.storm).then(results => {
Beispiel #26
0
import test from 'ava';
import context from '../helpers/mock-context';
import { createEllipse } from '../../src/canvas/primitives';

test('sets a specific color', (t) => {
  createEllipse(context, {x: 10, y: 10, radiusX: 2, radiusY: 2.5, color: 'lime' });
  t.deepEqual(context.strokeStyle, 'lime');
});

test.beforeEach(() => {
  createEllipse(context, {x: 10, y: 10, radiusX: 2, radiusY: 2.5});
});

test('sets the default color to \"hsla(0, 100%, 100%, 0.3)\"', (t) => {
  t.deepEqual(context.strokeStyle, 'hsla(0, 100%, 100%, 0.3)');
});

test('calls the stroke method', (t) => {
  t.deepEqual(context.stroke.called, true);
});

test.skip('calls the ellipse method with the default angle', (t) => {
  t.deepEqual(context.ellipse.calledWith(10, 10, 2, 2.5, 0), true);
});
Beispiel #27
0
    you like to pass the test.

    WAIT: dont use anything from Ramda just yet or
    any declarative style. Try to use "c" style code

====================================================== */

// write a function called swapper that takes and return a record
// with the keys swapped out
const swapper = (obj, k1, k2) => {
  let temp = {}
  temp[k2] = obj[k1]
  return temp
}
test.skip('Imperative swapper', t => {

  t.deepEqual(swapper({foo: 'bar'}, 'foo', 'baz') , {baz: 'bar'})
})

// write a function called keyer that takes a record and returns
// a new record with a key set to the value of the whole record
test.skip('Imperative keyer', t => {
  const keyer = (obj, k) => {
      let tempObj = {}
      tempObj[obj[k]] = swapper(obj, 'foo', 'baz')
      return tempObj
  }
  t.deepEqual(keyer({id: '42', foo: 'bar'}, 'id') , {'42':{id: '42', baz: 'bar'}})
})

// Use the "input" and "expected" data from above to pass this test
test.skip('Imperative 1', t => {
Beispiel #28
0
test('posthtml.config.js - {Function} - Process SML', (t) => {
  const ctx = {}

  return posthtmlrc(ctx).then((config) => {
    posthtml(config, 'index.sml', true)
      .then((result) => {
        t.is(expect('index.sml.html'), result.html)
      })
  })
})

test.skip('posthtml.config.js - {Function} - Process HTML', (t) => {
  return posthtmlrc().then((config) => {
    posthtml(config, 'index.html', true)
      .then((result) => {
        t.is(expect('index.html'), result.html)
      })
  })
})

test('posthtml.config.js - {Function} - Render JS', (t) => {
  const ctx = {}

  return posthtmlrc(ctx).then((config) => {
    t.is(config.options.render, undefined)
    t.is(config.options.from, './fixtures/index.sml')
    t.is(config.options.to, './expect/index.html')
  })
})

test('posthtml.config.js - {Function} - Render JSX', (t) => {
Beispiel #29
0
test.skip('Generator functions use special `function*` / `yield` syntax', t => {
  // Functions can only `return` once. Generators can `yield` many times.
  function* forever(x) {
    while (true) { // <-- Infinite loop! OK since generators are "lazy"
      yield x;
    }
  }

  t.is(typeof forever, 'function'); // Generators are still functions

  // Invoking the function creates a new iterable with a `.next` method.
  // The function then runs until it hits its first `yield` statement.

  let ones = forever(1);
  t.is(typeof ones, 'object');
  t.is(typeof ones.next, 'function');

  // Calling `next` returns the next value, as with any iterable.

  t.deepEqual(ones.next(), { value: 1, done: false });

  // Because we created an infinite loop, using `Array.from` would hang.
  // However, we can still pull a specific number of items from the generator.

  let rvals = [];
  for (let i = 0; i < 5; i++) {
    // Your Code Here
  }

  t.deepEqual(rvals, [1, 1, 1, 1, 1]);
});
} from './utils.js';

import simpleConfig from '../examples/simple/webpack.config.js';

const fs = testFs;

const simpleExamplePath = path.resolve(__dirname, '../examples/simple');
const webpackBuildPath = path.resolve(simpleExamplePath, './dist');

const readFile = Promise.promisify(fs.readFile, {context: fs});

let webpackBuildStats = null;

if (webpackMajorVersion === '4') {
    test.skip('will not be run', t => {
        t.fail();
    });
}
else {

    test.before('run webpack build first', async t => {
        webpackBuildStats = await runWebpackCompilerMemoryFs(simpleConfig);
    });

    test('it should run successfully', async t => {
        let {stats, errors} = webpackBuildStats;
        t.falsy(stats.hasWarnings() && errors.hasWarnings());
    });

    test('it should insert skeleton route into routes', async t => {
        let htmlContent = await readFile(path.join(webpackBuildPath, 'static/js/app.js'));