forked from angular/angular-cli
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(find-lazy-modules): Allow for any valid keys/value to be used
and properly understand and return the modules in this case. Also refactored that function to be clearer, and added a test to cover. I made sure the test was failing before this PR ;) Fixes angular#1891, angular#1960. cc @filipesilva @ericjim @chalin - See similar angular#1972
- Loading branch information
Showing
5 changed files
with
86 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import * as mockFs from 'mock-fs'; | ||
import {stripIndents} from 'common-tags'; | ||
import {expect} from 'chai'; | ||
|
||
import {findLazyModules} from '../../addon/ng2/models/find-lazy-modules'; | ||
|
||
|
||
(describe as any).only('find-lazy-module', () => { | ||
beforeEach(() => { | ||
mockFs({ | ||
'project-root': { | ||
'fileA.ts': stripIndents` | ||
const r1 = { | ||
"loadChildren": "moduleA" | ||
}; | ||
const r2 = { | ||
loadChildren: "moduleB" | ||
}; | ||
const r3 = { | ||
'loadChildren': 'moduleC' | ||
}; | ||
const r4 = { | ||
"loadChildren": 'app/+workspace/+settings/settings.module#SettingsModule' | ||
}; | ||
const r5 = { | ||
loadChildren: 'unexistentModule' | ||
}; | ||
`, | ||
// Create those files too as they have to exist. | ||
'moduleA.ts': '', | ||
'moduleB.ts': '', | ||
'moduleC.ts': '', | ||
'moduleD.ts': '', | ||
'app': { '+workspace': { '+settings': { 'settings.module.ts': '' } } } | ||
} | ||
}) | ||
}); | ||
afterEach(() => mockFs.restore()); | ||
|
||
it('works', () => { | ||
debugger; | ||
expect(findLazyModules('project-root')).to.eql([ | ||
'moduleA', | ||
'moduleB', | ||
'moduleC', | ||
'app/+workspace/+settings/settings.module' | ||
]); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters