Skip to content

Commit 18939e4

Browse files
authored
Change swSrc validation (#2451)
1 parent 0f2ffda commit 18939e4

File tree

3 files changed

+1
-45
lines changed

3 files changed

+1
-45
lines changed

packages/workbox-cli/src/lib/assert-valid-sw-src.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

packages/workbox-cli/src/lib/questions/ask-sw-src.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
const inquirer = require('inquirer');
1010
const ol = require('common-tags').oneLine;
1111

12-
const assertValidSWSrc = require('../assert-valid-sw-src');
13-
1412
// The key used for the question/answer.
1513
const name = 'swSrc';
1614

@@ -29,9 +27,5 @@ function askQuestion() {
2927

3028
module.exports = async () => {
3129
const answers = await askQuestion();
32-
const swSrc = answers[name].trim();
33-
34-
await assertValidSWSrc(swSrc);
35-
36-
return swSrc;
30+
return answers[name].trim();
3731
};

test/workbox-cli/node/lib/questions/ask-sw-src.js

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,12 @@ const MODULE_PATH = '../../../../../packages/workbox-cli/src/lib/questions/ask-s
1515
const QUESTION_NAME = 'swSrc';
1616

1717
describe(`[workbox-cli] lib/questions/ask-sw-src.js`, function() {
18-
it(`should reject when the valid SW assertion fails`, async function() {
19-
const injectedError = new Error('injected error');
20-
const askSWSrc = proxyquire(MODULE_PATH, {
21-
'inquirer': {
22-
prompt: () => Promise.resolve({[QUESTION_NAME]: ''}),
23-
},
24-
'../assert-valid-sw-src': () => Promise.reject(injectedError),
25-
});
26-
27-
try {
28-
await askSWSrc();
29-
throw new Error('Unexpected success.');
30-
} catch (error) {
31-
expect(error).to.eql(injectedError);
32-
}
33-
});
34-
3518
it(`should resolve with a valid answer to the question`, async function() {
3619
const expectedAnswer = 'expected answer';
3720
const askSWSrc = proxyquire(MODULE_PATH, {
3821
'inquirer': {
3922
prompt: () => Promise.resolve({[QUESTION_NAME]: expectedAnswer}),
4023
},
41-
'../assert-valid-sw-src': () => Promise.resolve(),
4224
});
4325

4426
const answer = await askSWSrc();

0 commit comments

Comments
 (0)