Skip to content

Commit

Permalink
feat: Added release channel as optional sign parameter (simple test) (#…
Browse files Browse the repository at this point in the history
…1400)

* feat: Added release channel as optional sign parameter
* test: Add test for sign channel parameter
  • Loading branch information
sneakypete81 authored and rpl committed Dec 14, 2018
1 parent 4eb7ca0 commit 942c308
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/cmd/sign.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export type SignParams = {|
sourceDir: string,
timeout: number,
verbose?: boolean,
channel?: string,
|};

export type SignOptions = {
Expand Down Expand Up @@ -57,6 +58,7 @@ export default function sign(
sourceDir,
timeout,
verbose,
channel,
}: SignParams,
{
build = defaultBuilder,
Expand Down Expand Up @@ -118,6 +120,7 @@ export default function sign(
xpiPath: buildResult.extensionPath,
version: manifestData.version,
downloadDir: artifactsDir,
channel,
});

if (signingResult.id) {
Expand Down
5 changes: 5 additions & 0 deletions src/program.js
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,11 @@ Example: $0 --help run.
describe: 'Number of milliseconds to wait before giving up',
type: 'number',
},
'channel': {
describe: 'The channel for which to sign the addon. Either ' +
'\'listed\' or \'unlisted\'',
type: 'string',
},
})
.command('run', 'Run the extension', commands.run, {
'target': {
Expand Down
11 changes: 11 additions & 0 deletions tests/unit/test-cmd/test.sign.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,17 @@ describe('sign', () => {
}
));

it('passes the channel parameter to the signer', () => withTempDir(
(tmpDir) => {
const stubs = getStubs();
return sign(tmpDir, stubs, {extraArgs: {channel: 'unlisted'}})
.then(() => {
sinon.assert.called(stubs.signAddon);
sinon.assert.calledWithMatch(stubs.signAddon, {channel: 'unlisted'});
});
}
));

it('passes the verbose flag to the signer', () => withTempDir(
(tmpDir) => {
const stubs = getStubs();
Expand Down

0 comments on commit 942c308

Please sign in to comment.