Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add test that shows directory stats are not correct #581

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions packages/unixfs/test/stat.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
Loading