This repository was archived by the owner on Mar 25, 2025. It is now read-only.
File tree 1 file changed +21
-1
lines changed
1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import fsExtra from "fs-extra";
3
3
import path from "path" ;
4
4
import tempy from "tempy" ;
5
5
6
- import { isDirectoryEmpty } from "../../src/helpers/directories" ;
6
+ import { isDirectoryEmpty , isDirectoryWriteable } from "../../src/helpers/directories" ;
7
7
8
8
// This has to be in sync with the valid files defined "helpers/directories".
9
9
const filesDirsTable : string [ ] [ ] = [
@@ -105,6 +105,26 @@ describe("directories", function () {
105
105
} ) ;
106
106
} ) ;
107
107
108
+ describe ( "when the directory is not writable" , function ( ) {
109
+ beforeEach ( async function ( ) {
110
+ await fsExtra . chmod ( testDirPath , 0o444 ) ;
111
+ } ) ;
112
+
113
+ test ( "returns false" , async function ( ) {
114
+ await expect ( isDirectoryWriteable ( testDirPath ) ) . resolves . toBe ( false ) ;
115
+ } ) ;
116
+ } ) ;
117
+
118
+ describe ( "when the directory is writable" , function ( ) {
119
+ beforeEach ( async function ( ) {
120
+ await fsExtra . chmod ( testDirPath , 0o777 ) ;
121
+ } ) ;
122
+
123
+ test ( "returns true" , async function ( ) {
124
+ await expect ( isDirectoryWriteable ( testDirPath ) ) . resolves . toBe ( true ) ;
125
+ } ) ;
126
+ } ) ;
127
+
108
128
afterEach ( function ( ) {
109
129
fsExtra . removeSync ( testDirPath ) ;
110
130
} ) ;
You can’t perform that action at this time.
0 commit comments