mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 21:19:50 +01:00
358ff748ea
PR-URL: https://github.com/nodejs/node/pull/54104 Fixes: https://github.com/nodejs/node/issues/54100 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
28 lines
777 B
JavaScript
28 lines
777 B
JavaScript
// Flags: --experimental-permission --allow-fs-read=*
|
|
'use strict';
|
|
|
|
const common = require('../common');
|
|
|
|
const assert = require('assert');
|
|
|
|
{
|
|
assert.ok(typeof process.permission.has === 'function');
|
|
assert.throws(() => {
|
|
process.permission.has(null, '');
|
|
}, common.expectsError({
|
|
code: 'ERR_INVALID_ARG_TYPE',
|
|
message: 'The "scope" argument must be of type string. Received null',
|
|
}));
|
|
assert.ok(!process.permission.has('invalid-key'));
|
|
assert.throws(() => {
|
|
process.permission.has('fs', {});
|
|
}, common.expectsError({
|
|
code: 'ERR_INVALID_ARG_TYPE',
|
|
message: 'The "reference" argument must be of type string. Received an instance of Object',
|
|
}));
|
|
}
|
|
|
|
{
|
|
assert.ok(!process.permission.has('FileSystemWrite', Buffer.from('reference')));
|
|
}
|