@@ -50,6 +50,112 @@ describe("DataLakePathClient", () => {
5050 await recorder . stop ( ) ;
5151 } ) ;
5252
53+ it ( "DataLakeFileClient create file path with directory dots" , async ( ) => {
54+ const fileBaseName = recorder . variable ( "filename" , getUniqueName ( "filename" ) ) ;
55+ const fileNameWithDots = "./adir/../anotherdir/.././" + fileBaseName ;
56+
57+ const fileClientWithDirDots = fileSystemClient . getFileClient ( fileNameWithDots ) ;
58+ await fileClientWithDirDots . create ( ) ;
59+
60+ let foundFile : boolean = false ;
61+ for await ( const listedFile of fileSystemClient . listPaths ( ) ) {
62+ if ( listedFile . name === fileBaseName && ! listedFile . isDirectory ) {
63+ foundFile = true ;
64+ }
65+ }
66+
67+ assert . ok ( foundFile , "The file should have been created." ) ;
68+ } ) ;
69+
70+ it ( "DataLakeDirectoryClient create directory path with directory dots" , async ( ) => {
71+ const subDirName = recorder . variable ( "dirname" , getUniqueName ( "dirname" ) ) ;
72+ const subDirNameWithDots = "./adir/.././anotherdir/.././" + subDirName ;
73+ const subDirClient = fileSystemClient . getDirectoryClient ( subDirNameWithDots ) ;
74+ await subDirClient . create ( ) ;
75+
76+ let foundSubDir : boolean = false ;
77+
78+ for await ( const listedFile of fileSystemClient . listPaths ( ) ) {
79+ if ( listedFile . name === subDirName && listedFile . isDirectory ) {
80+ foundSubDir = true ;
81+ }
82+ }
83+
84+ assert . ok ( foundSubDir , "The directory should have been created." ) ;
85+ } ) ;
86+
87+ it ( "DataLakeFileClient create file path with directory dots under a dir" , async ( ) => {
88+ const dirName = recorder . variable ( "dirname" , getUniqueName ( "dirname" ) ) ;
89+ const dirClient = fileSystemClient . getDirectoryClient ( dirName ) ;
90+ await dirClient . create ( ) ;
91+
92+ const fileBaseName = recorder . variable ( "filename" , getUniqueName ( "filename" ) ) ;
93+ const fileNameWithDots = "./adir/../anotherdir/.././" + fileBaseName ;
94+
95+ const fileClientWithDirDots = dirClient . getFileClient ( fileNameWithDots ) ;
96+ await fileClientWithDirDots . create ( ) ;
97+
98+ let foundFile : boolean = false ;
99+ for await ( const listedFile of fileSystemClient . listPaths ( { path : dirName } ) ) {
100+ if ( listedFile . name === `${ dirName } /${ fileBaseName } ` && ! listedFile . isDirectory ) {
101+ foundFile = true ;
102+ }
103+ }
104+
105+ assert . ok ( foundFile , "The file should have been created." ) ;
106+
107+ const fileUnderRootDirBaseName = recorder . variable ( "filename1" , getUniqueName ( "filename1" ) ) ;
108+ const fileUnderRootDir = "./adir/../../anotherdir/.././" + fileUnderRootDirBaseName ;
109+
110+ const fileUnderRootDirClient = dirClient . getFileClient ( fileUnderRootDir ) ;
111+ await fileUnderRootDirClient . create ( ) ;
112+
113+ foundFile = false ;
114+ for await ( const listedFile of fileSystemClient . listPaths ( ) ) {
115+ if ( listedFile . name === fileUnderRootDirBaseName && ! listedFile . isDirectory ) {
116+ foundFile = true ;
117+ }
118+ }
119+
120+ assert . ok ( foundFile , "The file should have been created." ) ;
121+ } ) ;
122+
123+ it ( "DataLakeDirectoryClient create directory path with directory dots under a dir" , async ( ) => {
124+ const dirName = recorder . variable ( "dirname" , getUniqueName ( "dirname" ) ) ;
125+ const dirClient = fileSystemClient . getDirectoryClient ( dirName ) ;
126+ await dirClient . create ( ) ;
127+
128+ const subDirBaseName = recorder . variable ( "subdirname" , getUniqueName ( "subdirname" ) ) ;
129+ const subDirNameWithDots = "./adir/../anotherdir/.././" + subDirBaseName ;
130+
131+ const dirClientWithDirDots = dirClient . getSubdirectoryClient ( subDirNameWithDots ) ;
132+ await dirClientWithDirDots . create ( ) ;
133+
134+ let foundSubDir : boolean = false ;
135+ for await ( const listedFile of fileSystemClient . listPaths ( { path : dirName } ) ) {
136+ if ( listedFile . name === `${ dirName } /${ subDirBaseName } ` && listedFile . isDirectory ) {
137+ foundSubDir = true ;
138+ }
139+ }
140+
141+ assert . ok ( foundSubDir , "The directory should have been created." ) ;
142+
143+ const dirUnderRootDirBaseName = recorder . variable ( "subdirname1" , getUniqueName ( "subdirname1" ) ) ;
144+ const dirUnderRootDir = "./adir/../../anotherdir/.././" + dirUnderRootDirBaseName ;
145+
146+ const fileUnderRootDirClient = dirClient . getSubdirectoryClient ( dirUnderRootDir ) ;
147+ await fileUnderRootDirClient . create ( ) ;
148+
149+ foundSubDir = false ;
150+ for await ( const listedFile of fileSystemClient . listPaths ( ) ) {
151+ if ( listedFile . name === dirUnderRootDirBaseName && listedFile . isDirectory ) {
152+ foundSubDir = true ;
153+ }
154+ }
155+
156+ assert . ok ( foundSubDir , "The directory should have been created." ) ;
157+ } ) ;
158+
53159 it ( "DataLakeFileClient create with meta data" , async ( ) => {
54160 const testFileName = recorder . variable ( "testfile" , getUniqueName ( "testfile" ) ) ;
55161 const testFileClient = fileSystemClient . getFileClient ( testFileName ) ;
0 commit comments