Skip to content

Commit 7a63326

Browse files
committed
chore: update to the latest standards and aegirs
1 parent 54ca0b0 commit 7a63326

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@
3838
"devDependencies": {
3939
"aegir": "^11.0.2",
4040
"chai": "^4.0.2",
41-
"pre-commit": "^1.2.2"
41+
"dirty-chai": "^2.0.0",
42+
"pre-commit": "^1.2.2",
43+
"safe-buffer": "^5.1.0"
4244
},
4345
"dependencies": {
4446
"protocol-buffers": "^3.2.1"
@@ -55,4 +57,4 @@
5557
"Pedro Teixeira <[email protected]>",
5658
"Richard Littauer <[email protected]>"
5759
]
58-
}
60+
}

test/unixfs-format.spec.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
/* eslint-env mocha */
22
'use strict'
33

4-
const expect = require('chai').expect
4+
const chai = require('chai')
5+
chai.use(require('dirty-chai'))
6+
const expect = chai.expect
57
const loadFixture = require('aegir/fixtures')
68

79
const UnixFS = require('../src')
@@ -10,10 +12,11 @@ const raw = loadFixture(__dirname, 'fixtures/raw.unixfs')
1012
const directory = loadFixture(__dirname, 'fixtures/directory.unixfs')
1113
const file = loadFixture(__dirname, 'fixtures/file.txt.unixfs')
1214
const symlink = loadFixture(__dirname, 'fixtures/symlink.txt.unixfs')
15+
const Buffer = require('safe-buffer').Buffer
1316

1417
describe('unixfs-format', () => {
1518
it('raw', (done) => {
16-
const data = new UnixFS('raw', new Buffer('bananas'))
19+
const data = new UnixFS('raw', Buffer.from('bananas'))
1720
const marsheled = data.marshal()
1821
const unmarsheled = UnixFS.unmarshal(marsheled)
1922
expect(data.type).to.equal(unmarsheled.type)
@@ -100,16 +103,16 @@ describe('unixfs-format', () => {
100103
try {
101104
data = new UnixFS('bananas')
102105
} catch (err) {
103-
expect(err).to.exist
104-
expect(data).to.not.exist
106+
expect(err).to.exist()
107+
expect(data).to.not.exist()
105108
done()
106109
}
107110
})
108111

109112
describe('interop', () => {
110113
it('raw', (done) => {
111114
const unmarsheled = UnixFS.unmarshal(raw)
112-
expect(unmarsheled.data).to.deep.equal(new Buffer('Hello UnixFS\n'))
115+
expect(unmarsheled.data).to.eql(Buffer.from('Hello UnixFS\n'))
113116
expect(unmarsheled.type).to.equal('file')
114117
expect(unmarsheled.marshal()).to.deep.equal(raw)
115118
done()
@@ -125,7 +128,7 @@ describe('unixfs-format', () => {
125128

126129
it('file', (done) => {
127130
const unmarsheled = UnixFS.unmarshal(file)
128-
expect(unmarsheled.data).to.deep.equal(new Buffer('Hello UnixFS\n'))
131+
expect(unmarsheled.data).to.deep.equal(Buffer.from('Hello UnixFS\n'))
129132
expect(unmarsheled.type).to.equal('file')
130133
expect(unmarsheled.marshal()).to.deep.equal(file)
131134
done()
@@ -136,7 +139,7 @@ describe('unixfs-format', () => {
136139

137140
it('symlink', (done) => {
138141
const unmarsheled = UnixFS.unmarshal(symlink)
139-
expect(unmarsheled.data).to.deep.equal(new Buffer('file.txt'))
142+
expect(unmarsheled.data).to.deep.equal(Buffer.from('file.txt'))
140143
expect(unmarsheled.type).to.equal('symlink')
141144
// TODO: waiting on https://github.com/ipfs/js-ipfs-data-importing/issues/3#issuecomment-182440079
142145
// expect(unmarsheled.marshal()).to.deep.equal(symlink)

0 commit comments

Comments
 (0)