From 8834fbc4f6ce12d35b5c570ce15a4ed5a2d7d409 Mon Sep 17 00:00:00 2001 From: Angel Mendez Date: Wed, 13 Dec 2023 13:41:17 -0600 Subject: [PATCH] refactor: replace got with node-fetch on v2-api.test.ts (#6246) * refactor: run tests concurrently * refactor: replace got with node-fetch on v2-api.test.ts related to #5695 --------- Co-authored-by: Sarah Etter --- tests/integration/commands/dev/v2-api.test.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/tests/integration/commands/dev/v2-api.test.ts b/tests/integration/commands/dev/v2-api.test.ts index 7eaa4979535..367857fbbda 100644 --- a/tests/integration/commands/dev/v2-api.test.ts +++ b/tests/integration/commands/dev/v2-api.test.ts @@ -5,7 +5,6 @@ import { gte } from 'semver' import { describe, expect, test } from 'vitest' import { FixtureTestContext, setupFixtureTests } from '../../utils/fixture.js' -import got from '../../utils/got.js' const siteInfo = { account_id: 'mock-account-id', @@ -26,16 +25,13 @@ const setup = async ({ fixture }) => { await execa('npm', ['install'], { cwd: fixture.directory }) } -describe.runIf(gte(version, '18.13.0'))('v2 api', () => { +describe.runIf(gte(version, '18.13.0')).concurrent('v2 api', () => { setupFixtureTests('dev-server-with-v2-functions', { devServer: true, mockApi: { routes }, setup }, () => { test('should successfully be able to run v2 functions', async ({ devServer }) => { - const response = await got(`http://localhost:${devServer.port}/.netlify/functions/ping`, { - throwHttpErrors: false, - retry: { limit: 0 }, - }) + const response = await fetch(`http://localhost:${devServer.port}/.netlify/functions/ping`) - expect(response.statusCode).toBe(200) - expect(response.body).toBe('pong') + expect(response.status).toBe(200) + expect(await response.text()).toBe('pong') }) test('supports streamed responses', async ({ devServer }) => {