From 730cd77065b3e7644328ec45c62cf66ef327f55a Mon Sep 17 00:00:00 2001 From: Russell Dempsey <1173416+SgtPooki@users.noreply.github.com> Date: Fri, 22 Nov 2024 07:45:44 -0800 Subject: [PATCH] chore: apply suggestions from code review --- test/e2e/edge-cases.test.ts | 3 --- test/e2e/setup/global-setup.ts | 4 +--- test/e2e/setup/ipfs-backend.ts | 7 ------- 3 files changed, 1 insertion(+), 13 deletions(-) diff --git a/test/e2e/edge-cases.test.ts b/test/e2e/edge-cases.test.ts index c098a1d..3c6974c 100644 --- a/test/e2e/edge-cases.test.ts +++ b/test/e2e/edge-cases.test.ts @@ -4,9 +4,6 @@ import { loadBlockFixtures } from './fixtures/load-block-fixtures.js' import { testExploredCid } from './fixtures/test-explore-cid.js' test.describe('edge-cases', () => { - /** - * @type {ReturnType} - */ let ipfs: KuboRPCClient test.beforeEach(async () => { ipfs = create(process.env.IPFS_RPC_ADDR) diff --git a/test/e2e/setup/global-setup.ts b/test/e2e/setup/global-setup.ts index 08459f5..4370469 100644 --- a/test/e2e/setup/global-setup.ts +++ b/test/e2e/setup/global-setup.ts @@ -8,12 +8,12 @@ const __filename = fileURLToPath(import.meta.url) // eslint-disable-next-line @typescript-eslint/naming-convention const __dirname = path.dirname(__filename) -// make sure that ipfs-backend is fully running interface ApiOpts { protocol: string host: string port: number } +// make sure that ipfs-backend is fully running const ensureKuboDaemon = async (apiOpts: ApiOpts): Promise => { const backendEndpoint = `${apiOpts.protocol}://${apiOpts.host}:${apiOpts.port}` const body = new FormData() @@ -47,8 +47,6 @@ const globalSetup = async (config: PlaywrightTestConfig): Promise => { await ensureKuboDaemon(apiOpts) - // Set and save RPC API endpoint in storageState, so test start against - // desired endpoint // @ts-expect-error - broken types for projects from playwright config const { baseURL, storageState } = config.projects[0].use const browser = await chromium.launch() diff --git a/test/e2e/setup/ipfs-backend.ts b/test/e2e/setup/ipfs-backend.ts index 493341c..2a9058d 100644 --- a/test/e2e/setup/ipfs-backend.ts +++ b/test/e2e/setup/ipfs-backend.ts @@ -1,4 +1,3 @@ -// @ts-check import fs from 'node:fs' import path from 'node:path' import { fileURLToPath } from 'url' @@ -15,7 +14,6 @@ const { console } = globalThis let ipfsd: KuboNode let ipfs: KuboRPCClient async function run (rpcPort?: string): Promise { - // let gatewayPort = 8080 if (ipfsd != null && ipfs != null) { throw new Error('IPFS backend already running') } @@ -25,7 +23,6 @@ async function run (rpcPort?: string): Promise { ipfs = create(endpoint) } else { // use ipfds-ctl to spawn daemon to expose http api used for e2e tests - // gatewayPort = await getPort(gatewayPort, '0.0.0.0') const factory = createFactory({ rpc: create, type: 'kubo', @@ -58,8 +55,6 @@ async function run (rpcPort?: string): Promise { const { address: apiHost, port: apiPort } = rpcApiMaddr.nodeAddress() const { hostname: gatewayHost, port: gatewayPort } = new URL(gateway) - // some temporary hardcoding until https://github.com/ipfs/js-ipfsd-ctl/issues/831 is resolved. - // const { apiHost, apiPort } = { apiHost: '127.0.0.1', apiPort: rpcPort } if (String(apiPort) !== rpcPort) { console.error(`Invalid RPC port returned by IPFS backend: ${apiPort} != ${rpcPort}`) @@ -67,8 +62,6 @@ async function run (rpcPort?: string): Promise { process.exit(1) } - // const rpcAddr = `/ip4/${apiHost}/tcp/${apiPort}` - // const gatewayAddr = endpoint ?? rpcAddr // persist details for e2e tests fs.writeFileSync(path.join(__dirname, 'ipfs-backend.json'), JSON.stringify({