Skip to content

Commit 7949aaa

Browse files
committed
fixes
1 parent fd1be15 commit 7949aaa

File tree

1 file changed

+32
-28
lines changed

1 file changed

+32
-28
lines changed

test/route-clear-config.js

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -56,48 +56,52 @@ describe('clear config route', () => {
5656
esmocha.clearAllMocks();
5757
});
5858

59-
it('allow returning home', function () {
59+
it('allow returning home', async function () {
6060
this.sandbox.stub(inquirer, 'prompt').returns(Promise.resolve({whatNext: 'home'}));
61-
return this.router.navigate('clearConfig').then(() => {
62-
sinon.assert.calledOnce(this.homeRoute);
63-
});
61+
62+
await this.router.navigate('clearConfig');
63+
64+
sinon.assert.calledOnce(this.homeRoute);
6465
});
6566

66-
it('allows clearing a generator and return user to home screen', function () {
67+
it('allows clearing a generator and return user to home screen', async function () {
6768
this.sandbox.stub(inquirer, 'prompt').returns(Promise.resolve({whatNext: 'foo'}));
68-
return this.router.navigate('clearConfig').then(() => {
69-
sinon.assert.calledOnce(this.globalConfig.remove);
70-
sinon.assert.calledWith(this.globalConfig.remove, 'foo');
71-
sinon.assert.calledOnce(this.homeRoute);
72-
});
69+
70+
await this.router.navigate('clearConfig');
71+
72+
sinon.assert.calledOnce(this.globalConfig.remove);
73+
sinon.assert.calledWith(this.globalConfig.remove, 'foo');
74+
sinon.assert.calledOnce(this.homeRoute);
7375
});
7476

75-
it('allows clearing all generators and return user to home screen', function () {
77+
it('allows clearing all generators and return user to home screen', async function () {
7678
this.sandbox.stub(inquirer, 'prompt').returns(Promise.resolve({whatNext: '*'}));
77-
return this.router.navigate('clearConfig').then(() => {
78-
sinon.assert.calledOnce(this.globalConfig.removeAll);
79-
sinon.assert.calledOnce(this.homeRoute);
80-
});
79+
80+
await this.router.navigate('clearConfig');
81+
82+
sinon.assert.calledOnce(this.globalConfig.removeAll);
83+
sinon.assert.calledOnce(this.homeRoute);
8184
});
8285

83-
it('shows generator with global config entry', function () {
86+
it('shows generator with global config entry', async function () {
8487
let choices = [];
8588

8689
this.sandbox.stub(inquirer, 'prompt').callsFake(argument => {
8790
({choices} = argument[0]);
8891
return Promise.resolve({whatNext: 'foo'});
8992
});
90-
return this.router.navigate('clearConfig').then(() => {
91-
// Clear all generators entry is present
92-
assert.ok(_.find(choices, {value: '*'}));
93-
94-
assert.ok(_.find(choices, {value: 'generator-unicorn'}));
95-
assert.ok(_.find(choices, {value: 'generator-phoenix'}));
96-
assert.ok(_.find(choices, {name: 'Unicorn'}));
97-
assert.ok(
98-
_.find(choices, {name: 'phoenix\u001B[31m (not installed anymore)\u001B[39m'})
99-
|| _.find(choices, {name: 'phoenix (not installed anymore)'}),
100-
);
101-
});
93+
94+
await this.router.navigate('clearConfig');
95+
96+
// Clear all generators entry is present
97+
assert.ok(_.find(choices, {value: '*'}));
98+
99+
assert.ok(_.find(choices, {value: 'generator-unicorn'}));
100+
assert.ok(_.find(choices, {value: 'generator-phoenix'}));
101+
assert.ok(_.find(choices, {name: 'Unicorn'}));
102+
assert.ok(
103+
_.find(choices, {name: 'phoenix\u001B[31m (not installed anymore)\u001B[39m'})
104+
|| _.find(choices, {name: 'phoenix (not installed anymore)'}),
105+
);
102106
});
103107
});

0 commit comments

Comments
 (0)