diff --git a/packages/unixfs/test/stat.spec.ts b/packages/unixfs/test/stat.spec.ts index 6b50d034a..b1cd92823 100644 --- a/packages/unixfs/test/stat.spec.ts +++ b/packages/unixfs/test/stat.spec.ts @@ -94,6 +94,20 @@ describe('stat', function () { }) }) + it('stats a directory with content', async () => { + const emptyDirCid = await fs.addDirectory() + const fileCid = await fs.addBytes(Buffer.from("Hello World!")) + const updateDirCid = await fs.cp(fileCid, emptyDirCid, 'foo1.txt') + const finalDirCid = await fs.cp(fileCid, updateDirCid, 'foo2.txt') + + await expect(fs.stat(finalDirCid)).to.eventually.include({ + fileSize: 0n, + dagSize: 134n, + blocks: 2, + type: 'directory' + }) + }) + it('should stat file with mode', async () => { const mode = 0o644 const cid = await fs.addFile({