@@ -7,11 +7,10 @@ import { Data, Name } from "@ndn/packet";
77import { makeMetadataPacket , MetadataKeyword } from "@ndn/rdr" ;
88import { BufferChunkSource , DataProducer } from "@ndn/segmented-object" ;
99import { makeObjectBody } from "@ndn/segmented-object/test-fixture/object-body" ;
10- import { configure as zenfsConfigure , fs as zenfs } from "@zenfs/core" ;
1110import { collect } from "streaming-iterables" ;
12- import { afterAll , beforeAll , describe , expect , test } from "vitest" ;
11+ import { afterAll , beforeAll , expect , test } from "vitest" ;
1312
14- import { buildDirectoryListing , Client , FileMetadata , lsKeyword , ModeDir , ModeFile , NDNZenFS } from ".." ;
13+ import { buildDirectoryListing , Client , FileMetadata , lsKeyword , ModeDir , ModeFile } from ".." ;
1514
1615// Directory hierarchy:
1716// /
@@ -83,15 +82,6 @@ beforeAll(async () => {
8382 ) ;
8483
8584 client = new Client ( prefix ) ;
86-
87- await zenfsConfigure ( {
88- mounts : {
89- "/N" : {
90- backend : NDNZenFS ,
91- client,
92- } ,
93- } ,
94- } ) ;
9585} ) ;
9686afterAll ( Forwarder . deleteDefault ) ;
9787
@@ -148,52 +138,3 @@ test.each(readFileIntoCases)("readFileInto [%d,%d)", async (...tc) => {
148138 await client . readFileInto ( statB , ...args ) ;
149139 } , ...tc ) ;
150140} ) ;
151-
152- test ( "zenfs rejects" , async ( ) => {
153- expect ( ( ) => zenfs . statSync ( "/N/A" ) ) . toThrow ( / a s y n c / ) ;
154- expect ( ( ) => zenfs . readdirSync ( "/N/A" ) ) . toThrow ( / a s y n c / ) ;
155- await expect ( zenfs . promises . appendFile ( "/N/A/B.bin" , "tail" ) ) . rejects . toThrow ( / r e a d - o n l y / ) ;
156- expect ( ( ) => zenfs . readFileSync ( "/N/A/B.bin" ) ) . toThrow ( / a s y n c / ) ;
157- expect ( ( ) => zenfs . openSync ( "/N/A/B.bin" , "r" ) ) . toThrow ( / a s y n c / ) ;
158- } ) ;
159-
160- test ( "zenfs stat" , async ( ) => {
161- const statRoot = await zenfs . promises . stat ( "/N" ) ;
162- expect ( statRoot . isDirectory ( ) ) . toBeTruthy ( ) ;
163-
164- const statA = await zenfs . promises . stat ( "/N/A" ) ;
165- expect ( statA . isDirectory ( ) ) . toBeTruthy ( ) ;
166-
167- const statB = await zenfs . promises . stat ( "/N/A/B.bin" ) ;
168- expect ( statB . isFile ( ) ) . toBeTruthy ( ) ;
169- expect ( statB . size ) . toBe ( bodyB . length ) ;
170- } ) ;
171-
172- describe ( "zenfs open" , ( ) => {
173- let fh : zenfs . promises . FileHandle ;
174- beforeAll ( async ( ) => {
175- fh = await zenfs . promises . open ( "/N/A/B.bin" , "r" ) ;
176- } ) ;
177- afterAll ( async ( ) => {
178- await fh . close ( ) ;
179- } ) ;
180-
181- test ( "stat" , async ( ) => {
182- expect ( ( await fh . stat ( ) ) . size ) . toBe ( bodyB . length ) ;
183- } ) ;
184-
185- test . each ( readFileIntoCases ) ( "read [%d,%d)" , async ( ...tc ) => {
186- await testReadFileInto ( async ( ...args ) => {
187- await fh . read ( ...args ) ;
188- } , ...tc ) ;
189- } ) ;
190- } ) ;
191-
192- test ( "zenfs readdir" , async ( ) => {
193- await expect ( zenfs . promises . readdir ( "/N" ) ) . resolves . toEqual ( [ "A" ] ) ;
194- await expect ( zenfs . promises . readdir ( "/N/A" ) ) . resolves . toEqual ( [ "B.bin" ] ) ;
195- } ) ;
196-
197- test ( "zenfs readFile" , async ( ) => {
198- await expect ( zenfs . promises . readFile ( "/N/A/B.bin" ) ) . resolves . toEqualUint8Array ( bodyB ) ;
199- } ) ;
0 commit comments