Skip to content

Commit

Permalink
Revert changes to hash test
Browse files Browse the repository at this point in the history
  • Loading branch information
corrideat committed Jan 5, 2025
1 parent 01d5eec commit 4226b75
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion build/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ async function get(args) {

// src/hash.ts
init_utils();
async function hash(args, multicode, internal = false) {
async function hash(args, multicode = multicodes.RAW, internal = false) {
const [filename] = args;
if (!filename) {
console.error("please pass in a file");
Expand Down
8 changes: 4 additions & 4 deletions test/hash.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ Deno.test({

await t.step('it should create a raw CID for a json file', async () => {
const filepath = './test/assets/hello.json'
const actual = await hash([filepath], multicodes.JSON, true)
const expected = 'zyop8PQypgycyyCEcQsEHoc9Z8S9bQt1CuHuRKnXrAXagVBGxQyvH'
const actual = await hash([filepath], multicodes.RAW, true)
const expected = 'z9brRu3VWh2crTt5nDjmu8dciMkHp1LR3wmDaqEqXHK46RbuTPy3'
assertEquals(actual, expected)

const cid = CID.parse(actual, base58btc.decoder)
assertEquals(cid.code, multicodes.JSON)
assertEquals(cid.byteLength, 39)
assertEquals(cid.code, multicodes.RAW)
assertEquals(cid.byteLength, 38)
assertEquals(cid.multihash.code, 45600)
assertEquals(cid.version, 1)
})
Expand Down

0 comments on commit 4226b75

Please sign in to comment.