Skip to content

Commit

Permalink
Test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mshima committed Jan 29, 2020
1 parent b437e75 commit 006e13e
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 36 deletions.
66 changes: 40 additions & 26 deletions test/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -1276,26 +1276,8 @@ describe('Base', () => {
};
});

it('run custom priorities in correct order', function() {
const prePrompting1 = sinon.spy();
const preConfiguring1 = sinon.spy();
const preConfiguring2 = sinon.spy();
const afterEnd = sinon.spy();

const initializing = sinon.spy();
const prompting = sinon.spy();
const configuring = sinon.spy();
const end = sinon.spy();

it('generates correct _queues and runLoop queueNames', function() {
_.extend(this.TestGenerator.prototype, {
prePrompting1,
preConfiguring1,
preConfiguring2,
afterEnd,
initializing,
prompting,
configuring,
end,
assert: function() {
assert.deepStrictEqual(this._queues, {
initializing: 'initializing',
Expand Down Expand Up @@ -1336,14 +1318,46 @@ describe('Base', () => {
'skip-install': true
});

return this.testGen.run();
});

it('run custom priorities in correct order', function() {
const prePrompting1 = sinon.spy();
const preConfiguring1 = sinon.spy();
const preConfiguring2 = sinon.spy();
const afterEnd = sinon.spy();

const initializing = sinon.spy();
const prompting = sinon.spy();
const configuring = sinon.spy();
const end = sinon.spy();

_.extend(this.TestGenerator.prototype, {
prePrompting1,
preConfiguring1,
preConfiguring2,
afterEnd,
initializing,
prompting,
configuring,
end
});

this.testGen = new this.TestGenerator([], {
resolved: 'generator-ember/all/index.js',
namespace: 'dummy',
env: this.env,
'skip-install': true
});

return this.testGen.run().then(() => {
initializing.calledBefore(prePrompting1);
preConfiguring1.calledBefore(initializing);
preConfiguring2.calledBefore(configuring);
configuring.calledBefore(prePrompting1);
prePrompting1.calledBefore(prompting);
prompting.calledBefore(end);
end.calledBefore(afterEnd);
assert(initializing.calledBefore(preConfiguring1));
assert(preConfiguring1.calledBefore(preConfiguring2));
assert(preConfiguring2.calledBefore(configuring));
assert(configuring.calledBefore(prePrompting1));
assert(prePrompting1.calledBefore(prompting));
assert(prompting.calledBefore(end));
assert(end.calledBefore(afterEnd));
});
});
});
Expand Down
10 changes: 0 additions & 10 deletions test/generators-compose-workflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,6 @@ describe('Multiples generators', () => {
this.Dummy = class extends Base {};
this.spyExec = sinon.spy();
this.Dummy.prototype.exec = this.spyExec;

this.dummy = new this.Dummy(['bar', 'baz', 'bom'], {
foo: false,
something: 'else',
// Mandatory options, created by the `env#create()` helper
resolved: resolveddir,
namespace: 'dummy',
env: this.env,
'skip-install': true
});
});

describe('#composeWith() with multiples generators', () => {
Expand Down

0 comments on commit 006e13e

Please sign in to comment.