Skip to content

Commit

Permalink
chore: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
achingbrain committed Jan 8, 2025
1 parent 7a3ea36 commit affdcd3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/integration-tests/test/fetch.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { type Fetch, fetch } from '@libp2p/fetch'
import { expect } from 'aegir/chai'
import { createLibp2p } from 'libp2p'
import { toString as uint8ArrayToString } from 'uint8arrays/to-string'
import { isWebWorker } from 'wherearewe'
import { createBaseOptions } from './fixtures/base-options.js'
import type { Libp2p } from '@libp2p/interface'
Expand Down Expand Up @@ -31,9 +32,9 @@ describe('fetch', () => {
const DATA_B = { foobar: 'goodnight moon' }

const generateLookupFunction = function (prefix: string, data: Record<string, string>) {
return async function (key: string): Promise<Uint8Array | undefined> {
return async function (key: Uint8Array): Promise<Uint8Array | undefined> {
key = key.slice(prefix.length) // strip prefix from key
const val = data[key]
const val = data[uint8ArrayToString(key)]
if (val != null) {
return (new TextEncoder()).encode(val)
}
Expand Down

0 comments on commit affdcd3

Please sign in to comment.