1'use strict'; 2 3const common = require('../common'); 4const assert = require('assert'); 5const fs = require('fs'); 6 7[false, 1, {}, [], null, undefined].forEach((i) => { 8 assert.throws( 9 () => fs.chown(i, 1, 1, common.mustNotCall()), 10 { 11 code: 'ERR_INVALID_ARG_TYPE', 12 name: 'TypeError' 13 } 14 ); 15 assert.throws( 16 () => fs.chownSync(i, 1, 1), 17 { 18 code: 'ERR_INVALID_ARG_TYPE', 19 name: 'TypeError' 20 } 21 ); 22}); 23 24[false, 'test', {}, [], null, undefined].forEach((i) => { 25 assert.throws( 26 () => fs.chown('not_a_file_that_exists', i, 1, common.mustNotCall()), 27 { 28 code: 'ERR_INVALID_ARG_TYPE', 29 name: 'TypeError' 30 } 31 ); 32 assert.throws( 33 () => fs.chown('not_a_file_that_exists', 1, i, common.mustNotCall()), 34 { 35 code: 'ERR_INVALID_ARG_TYPE', 36 name: 'TypeError' 37 } 38 ); 39 assert.throws( 40 () => fs.chownSync('not_a_file_that_exists', i, 1), 41 { 42 code: 'ERR_INVALID_ARG_TYPE', 43 name: 'TypeError' 44 } 45 ); 46 assert.throws( 47 () => fs.chownSync('not_a_file_that_exists', 1, i), 48 { 49 code: 'ERR_INVALID_ARG_TYPE', 50 name: 'TypeError' 51 } 52 ); 53}); 54