Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.

Commit d02e535

Browse files
author
Pedro Santos
committed
chore: dedup existing promise-based tests
1 parent 91adca1 commit d02e535

File tree

3 files changed

+3
-37
lines changed

3 files changed

+3
-37
lines changed

src/files-regular/add.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,6 @@ module.exports = (common, options) => {
6868
expect(file.size).greaterThan(fixtures.smallFile.data.length)
6969
})
7070

71-
it('should add a Buffer (promised)', async () => {
72-
const filesAdded = await ipfs.add(fixtures.smallFile.data)
73-
const file = filesAdded[0]
74-
75-
expect(file.hash).to.equal(fixtures.smallFile.cid)
76-
expect(file.path).to.equal(fixtures.smallFile.cid)
77-
})
78-
7971
it('should add a BIG Buffer', async () => {
8072
const filesAdded = await ipfs.add(fixtures.bigFile.data)
8173
expect(filesAdded).to.have.length(1)
@@ -303,7 +295,7 @@ module.exports = (common, options) => {
303295
expect(wrapped.path).to.equal('')
304296
})
305297

306-
it('should add with only-hash=true (promised)', async function () {
298+
it('should add with only-hash=true', async function () {
307299
this.slow(10 * 1000)
308300
const content = String(Math.random() + Date.now())
309301

src/object/links.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ module.exports = (common, options) => {
2929

3030
after(() => common.teardown())
3131

32-
it('should get empty links by multihash (promised)', async () => {
32+
it('should get empty links by multihash', async () => {
3333
const testObj = {
3434
Data: Buffer.from(hat()),
3535
Links: []

src/object/patch/add-link.js

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,7 @@
44
const dagPB = require('ipld-dag-pb')
55
const DAGNode = dagPB.DAGNode
66
const { getDescribe, getIt, expect } = require('../../utils/mocha')
7-
const {
8-
calculateCid,
9-
createDAGNode,
10-
addLinkToDAGNode,
11-
asDAGLink
12-
} = require('../utils')
7+
const { asDAGLink } = require('../utils')
138

149
/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */
1510
/**
@@ -77,27 +72,6 @@ module.exports = (common, options) => {
7772
*/
7873
})
7974

80-
it('should add a link to an existing node (promised)', async () => {
81-
const obj = {
82-
Data: Buffer.from('patch test object (promised)'),
83-
Links: []
84-
}
85-
86-
const parentCid = await ipfs.object.put(obj)
87-
const parent = await ipfs.object.get(parentCid)
88-
const childCid = await ipfs.object.put(await createDAGNode(Buffer.from('some other node'), []))
89-
const child = await ipfs.object.get(childCid)
90-
const newParent = await addLinkToDAGNode(parent, {
91-
name: 'link-to-node',
92-
size: child.size,
93-
cid: childCid
94-
})
95-
const newParentCid = await calculateCid(newParent)
96-
const nodeFromObjectPatchCid = await ipfs.object.patch.addLink(parentCid, newParent.Links[0])
97-
98-
expect(newParentCid).to.eql(nodeFromObjectPatchCid)
99-
})
100-
10175
it('returns error for request without arguments', async () => {
10276
try {
10377
await ipfs.object.patch.addLink(null, null, null)

0 commit comments

Comments
 (0)