-
Notifications
You must be signed in to change notification settings - Fork 827
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve the code that swaps 'prod' for 'dev' in copyWorkboxLibraries (#…
…1488) * (Slightly) improve the code that swaps 'prod' for 'dev' in filepaths. * Update some strings. * Typo. * String mismatch in a test. * Sigh... adding @Private
- Loading branch information
1 parent
49ec72a
commit 90883e6
Showing
2 changed files
with
54 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const expect = require('chai').expect; | ||
|
||
const useBuildType = require('../../../../packages/workbox-build/src/lib/use-build-type'); | ||
|
||
describe(`[workbox-build] lib/use-build-type.js`, function() { | ||
it(`should not update anything when buildType is 'prod'`, function() { | ||
const result = useBuildType('/path/to/workbox.prod.js', 'prod'); | ||
expect(result).to.eql('/path/to/workbox.prod.js'); | ||
}); | ||
|
||
it(`should update when buildType is 'dev'`, function() { | ||
const result = useBuildType('/path/to/workbox.prod.js', 'dev'); | ||
expect(result).to.eql('/path/to/workbox.dev.js'); | ||
}); | ||
|
||
it(`should only update the last match when buildType is 'dev'`, function() { | ||
const result = useBuildType('/path/to/production/and.prod.check/workbox.prod.js', 'dev'); | ||
expect(result).to.eql('/path/to/production/and.prod.check/workbox.dev.js'); | ||
}); | ||
|
||
it(`should not update anything if there is no match for the default build type`, function() { | ||
const result = useBuildType('/does/not/match', 'dev'); | ||
expect(result).to.eql('/does/not/match'); | ||
}); | ||
}); |