Skip to content

Commit

Permalink
test: update and enable config e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
clydin authored and hansl committed Mar 28, 2018
1 parent 64ebf9c commit 0874709
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 31 deletions.
14 changes: 0 additions & 14 deletions tests/e2e/tests/commands/config/config-get-app-value.ts

This file was deleted.

14 changes: 7 additions & 7 deletions tests/e2e/tests/commands/config/config-get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@ import {expectToFail} from '../../../utils/utils';

export default function() {
return Promise.resolve()
.then(() => process.chdir('/'))
.then(() => expectToFail(() => ng('config', 'defaults.component.inlineStyle')))
.then(() => ng('config', '--global', 'defaults.component.inlineStyle'))
.then(() => expectToFail(() => ng('config', 'schematics.@schematics/angular.component.inlineStyle'))
.then(() => ng('config', 'schematics.@schematics/angular.component.inlineStyle', 'false'))
.then(() => ng('config', 'schematics.@schematics/angular.component.inlineStyle'))
.then(({ stdout }) => {
if (!stdout.match(/false\n?/)) {
throw new Error(`Expected "false", received "${JSON.stringify(stdout)}".`);
}
})
.then(() => expectToFail(() => {
return ng('config', '--global', 'defaults.component.inlineStyle', 'INVALID_BOOLEAN');
return ng('config', 'schematics.@schematics/angular.component.inlineStyle', 'INVALID_BOOLEAN');
}))
.then(() => ng('config', '--global', 'defaults.component.inlineStyle', 'true'))
.then(() => ng('config', '--global', 'defaults.component.inlineStyle'))
.then(() => ng('config', 'schematics.@schematics/angular.component.inlineStyle', 'true'))
.then(() => ng('config', 'schematics.@schematics/angular.component.inlineStyle'))
.then(({ stdout }) => {
if (!stdout.match(/true\n?/)) {
throw new Error(`Expected "true", received "${JSON.stringify(stdout)}".`);
}
})
.then(() => ng('config', '--global', 'defaults.component.inlineStyle', 'false'));
.then(() => ng('config', 'schematics.@schematics/angular.component.inlineStyle', 'false'));
}
10 changes: 7 additions & 3 deletions tests/e2e/tests/commands/config/config-set-enum-check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import {expectToFail} from '../../../utils/utils';

export default function() {
return Promise.resolve()
.then(() => expectToFail(() => ng('config', 'defaults.component.aaa', 'bbb')))
.then(() => expectToFail(() => ng('config', 'defaults.component.viewEncapsulation', 'bbb')))
.then(() => ng('config', 'defaults.component.viewEncapsulation', 'Emulated'));
.then(() => expectToFail(() => ng('config', 'schematics.@schematics/angular.component.aaa', 'bbb')))
.then(() => expectToFail(() => ng(
'config',
'schematics.@schematics/angular.component.viewEncapsulation',
'bbb'
)))
.then(() => ng('config', 'schematics.@schematics/angular.component.viewEncapsulation', '"Emulated"'));
}
2 changes: 2 additions & 0 deletions tests/e2e/tests/commands/config/config-set-prefix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import {expectToFail} from '../../../utils/utils';
import * as fs from 'fs';

export default function() {
return;

return Promise.resolve()
.then(() => expectToFail(() => ng('config', 'apps.zzz.prefix')))
.then(() => ng('config', 'apps.0.prefix' , 'new-prefix'))
Expand Down
10 changes: 5 additions & 5 deletions tests/e2e/tests/commands/config/config-set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import {expectToFail} from '../../../utils/utils';

export default function() {
return Promise.resolve()
.then(() => expectToFail(() => ng('config', 'apps.zzz.prefix')))
.then(() => ng('config', 'apps.0.prefix' , 'new-prefix'))
.then(() => ng('config', 'apps.0.prefix'))
.then(() => expectToFail(() => ng('config', 'cli.warnings.zzzz')))
.then(() => ng('config', 'cli.warnings.typescriptMismatch' , 'false'))
.then(() => ng('config', 'cli.warnings.typescriptMismatch'))
.then(({ stdout }) => {
if (!stdout.match(/new-prefix/)) {
throw new Error(`Expected "new-prefix", received "${JSON.stringify(stdout)}".`);
if (!stdout.match(/false/)) {
throw new Error(`Expected "false", received "${JSON.stringify(stdout)}".`);
}
});
}
2 changes: 0 additions & 2 deletions tests/e2e_runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,6 @@ const allTests = glob.sync(path.join(e2eRoot, testGlob), { nodir: true, ignore:
.filter(name => !name.endsWith('/component-not-flat.ts'))
.filter(name => !name.endsWith('/component-prefix.ts'))
.filter(name => !name.endsWith('/directive-prefix.ts'))
// CONFIG COMMAND
.filter(name => !name.includes('tests/commands/config/'))
// NEW COMMAND
.filter(name => !name.includes('tests/commands/new/'))
// NEEDS devkit change
Expand Down

0 comments on commit 0874709

Please sign in to comment.