Skip to content

Commit 2f98093

Browse files
committed
test: added test for disabling checking of updates during development
1 parent 672df89 commit 2f98093

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

src/program.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export class Program {
9292
{
9393
checkForUpdates = defaultUpdateChecker, systemProcess = process,
9494
logStream = defaultLogStream, getVersion = defaultVersionGetter,
95-
shouldExitProgram = true, localEnv = 'development',
95+
shouldExitProgram = true, localEnv = WEBEXT_BUILD_ENV,
9696
}: Object = {}
9797
): Promise<void> {
9898

tests/unit/test-util/test.updates.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ describe('util/updates', () => {
2222
assert.equal(updateNotifierStub.firstCall.args[0].pkg.name, 'web-ext');
2323
assert.equal(updateNotifierStub.firstCall.args[0].pkg.version, '1.0.0');
2424
assert.equal(updateNotifierStub.firstCall.args[0].updateCheckInterval,
25-
1000 * 60 * 60 * 24 * 7);
25+
1000 * 60 * 60 * 24 * 7);
2626
});
2727
});
2828
});

tests/unit/test.program.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,22 @@ describe('program.Program', () => {
263263
'some-package-version');
264264
});
265265
});
266+
267+
it('does not check for updates during development', () => {
268+
const handler = spy();
269+
const getVersion = () => 'some-package-version';
270+
const checkForUpdates = sinon.stub();
271+
const program = new Program(['run'])
272+
.command('run', 'some command', handler);
273+
return execProgram(program, {
274+
checkForUpdates,
275+
getVersion,
276+
localEnv: 'development',
277+
})
278+
.then(() => {
279+
assert.equal(checkForUpdates.called, false);
280+
});
281+
});
266282
});
267283

268284

0 commit comments

Comments
 (0)