test: add test for setJumpList
arguments (#41650)
test: add test for setJumpList arguments
This commit is contained in:
parent
00e3445f8a
commit
a32705fd30
2 changed files with 39 additions and 1 deletions
|
@ -1281,7 +1281,7 @@ JumpListResult App::SetJumpList(v8::Local<v8::Value> val,
|
|||
if (!delete_jump_list &&
|
||||
!gin::ConvertFromV8(args->isolate(), val, &categories)) {
|
||||
gin_helper::ErrorThrower(args->isolate())
|
||||
.ThrowError("Argument must be null or an array of categories");
|
||||
.ThrowTypeError("Argument must be null or an array of categories");
|
||||
return JumpListResult::kArgumentError;
|
||||
}
|
||||
|
||||
|
|
|
@ -996,6 +996,44 @@ describe('app module', () => {
|
|||
});
|
||||
});
|
||||
|
||||
ifdescribe(process.platform === 'win32')('setJumpList(categories)', () => {
|
||||
it('throws an error when categories is not null or an array', () => {
|
||||
expect(() => {
|
||||
app.setJumpList('string' as any);
|
||||
}).to.throw('Argument must be null or an array of categories');
|
||||
});
|
||||
|
||||
it('can get jump list settings', () => {
|
||||
const settings = app.getJumpListSettings();
|
||||
expect(settings).to.eql({ minItems: 10, removedItems: [] });
|
||||
});
|
||||
|
||||
it('can set a jump list with an array of categories', () => {
|
||||
expect(() => {
|
||||
app.setJumpList([
|
||||
{ type: 'frequent' },
|
||||
{
|
||||
items: [{
|
||||
type: 'task',
|
||||
title: 'New Project',
|
||||
program: process.execPath,
|
||||
args: '--new-project',
|
||||
description: 'Create a new project.'
|
||||
},
|
||||
{ type: 'separator' },
|
||||
{
|
||||
type: 'task',
|
||||
title: 'Recover Project',
|
||||
program: process.execPath,
|
||||
args: '--recover-project',
|
||||
description: 'Recover Project'
|
||||
}]
|
||||
}
|
||||
]);
|
||||
}).to.not.throw();
|
||||
});
|
||||
});
|
||||
|
||||
describe('getAppPath', () => {
|
||||
it('works for directories with package.json', async () => {
|
||||
const { appPath } = await runTestApp('app-path');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue