File tree 1 file changed +6
-9
lines changed
1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change 2
2
import * as path from "@std/path" ;
3
3
import { Buffer } from "node:buffer" ;
4
4
import * as fs from "node:fs/promises" ;
5
- import { assert , assertEquals } from "@std/assert" ;
5
+ import { assert , assertEquals , assertRejects } from "@std/assert" ;
6
6
7
7
const moduleDir = path . dirname ( path . fromFileUrl ( import . meta. url ) ) ;
8
8
const testData = path . resolve ( moduleDir , "testdata" , "hello.txt" ) ;
@@ -286,14 +286,11 @@ Deno.test({
286
286
const nobodyUid = 65534 ;
287
287
const nobodyGid = 65534 ;
288
288
289
- try {
290
- await fileHandle . chown ( nobodyUid , nobodyGid ) ;
291
- } catch ( e ) {
292
- assert (
293
- e instanceof Deno . errors . PermissionDenied ,
294
- "Expected permissionDenied error" ,
295
- ) ;
296
- }
289
+ assertRejects (
290
+ async ( ) => await fileHandle . chown ( nobodyUid , nobodyGid ) ,
291
+ Deno . errors . PermissionDenied ,
292
+ "Operation not permitted" ,
293
+ ) ;
297
294
298
295
const realUid = Deno . uid ( ) || 1000 ;
299
296
const realGid = Deno . gid ( ) || 1000 ;
You can’t perform that action at this time.
0 commit comments