Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

refactor: replace ipfs.add in dag.get tests #2987

Closed
wants to merge 2 commits into from
Closed
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
7 changes: 4 additions & 3 deletions packages/interface-ipfs-core/src/dag/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const dagPB = require('ipld-dag-pb')
const DAGNode = dagPB.DAGNode
const dagCBOR = require('ipld-dag-cbor')
const Unixfs = require('ipfs-unixfs')
const all = require('it-all')
const { getDescribe, getIt, expect } = require('../utils/mocha')

/** @typedef { import("ipfsd-ctl/src/factory") } Factory */
Expand Down Expand Up @@ -154,9 +153,11 @@ module.exports = (common, options) => {
it('should get a node added as CIDv1 with a CIDv0', async () => {
const input = Buffer.from(`TEST${Math.random()}`)

const res = await all(ipfs.add(input, { cidVersion: 1, rawLeaves: false }))
const inner = new Unixfs({ type: 'file', data: input })
const serialized = new DAGNode(inner.marshal()).serialize()
const res = await ipfs.block.put(serialized, { version: 1 })

const cidv1 = res[0].cid
const cidv1 = res.cid
expect(cidv1.version).to.equal(1)

const cidv0 = cidv1.toV0()
Expand Down