2024-12-12 09:11:58 -03:00
|
|
|
// Flags: --permission --allow-fs-read=*
|
2023-04-04 14:14:04 -03:00
|
|
|
'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',
|
|
|
|
}));
|
|
|
|
}
|
2024-08-03 13:46:57 -03:00
|
|
|
|
|
|
|
{
|
|
|
|
assert.ok(!process.permission.has('FileSystemWrite', Buffer.from('reference')));
|
|
|
|
}
|