Skip to content

Commit 06f3c56

Browse files
committed
file and symlink tests, next: interop
1 parent 8a3bc81 commit 06f3c56

File tree

1 file changed

+38
-3
lines changed

1 file changed

+38
-3
lines changed

tests/test-unixfs-format.js

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,45 @@ describe('unixfs-format', () => {
3838
done()
3939
})
4040

41-
it.skip('file add blocksize', (done) => {})
42-
it.skip('file add and remove blocksize', (done) => {})
41+
it('file add blocksize', (done) => {
42+
const data = new UnixfsFormat('file')
43+
data.addBlockSize(256)
44+
const marsheled = data.marshal()
45+
const unmarsheled = UnixfsFormat.unmarshal(marsheled)
46+
expect(data.type).to.equal(unmarsheled.type)
47+
expect(data.data).to.deep.equal(unmarsheled.data)
48+
expect(data.blockSizes).to.deep.equal(unmarsheled.blockSizes)
49+
expect(data.fileSize()).to.deep.equal(unmarsheled.fileSize())
50+
done()
51+
})
52+
53+
it('file add and remove blocksize', (done) => {
54+
const data = new UnixfsFormat('file')
55+
data.addBlockSize(256)
56+
const marsheled = data.marshal()
57+
const unmarsheled = UnixfsFormat.unmarshal(marsheled)
58+
expect(data.type).to.equal(unmarsheled.type)
59+
expect(data.data).to.deep.equal(unmarsheled.data)
60+
expect(data.blockSizes).to.deep.equal(unmarsheled.blockSizes)
61+
expect(data.fileSize()).to.deep.equal(unmarsheled.fileSize())
62+
unmarsheled.removeBlockSize(0)
63+
expect(data.blockSizes).to.not.deep.equal(unmarsheled.blockSizes)
64+
done()
65+
})
66+
67+
// figuring out what is this metadata for https://github.com/ipfs/js-ipfs-data-importing/issues/3#issuecomment-182336526
4368
it.skip('metadata', (done) => {})
44-
it.skip('symlink', (done) => {})
69+
70+
it('symlink', (done) => {
71+
const data = new UnixfsFormat('symlink')
72+
const marsheled = data.marshal()
73+
const unmarsheled = UnixfsFormat.unmarshal(marsheled)
74+
expect(data.type).to.equal(unmarsheled.type)
75+
expect(data.data).to.deep.equal(unmarsheled.data)
76+
expect(data.blockSizes).to.deep.equal(unmarsheled.blockSizes)
77+
expect(data.fileSize()).to.deep.equal(unmarsheled.fileSize())
78+
done()
79+
})
4580
it('wrong type', (done) => {
4681
var data
4782
try {

0 commit comments

Comments
 (0)