diff --git a/__tests__/helpers/get-api-mock.ts b/__tests__/helpers/get-api-mock.ts index 687ddabe5..66ebd4e87 100644 --- a/__tests__/helpers/get-api-mock.ts +++ b/__tests__/helpers/get-api-mock.ts @@ -1,9 +1,9 @@ -import nock from 'nock'; +import nock from "nock"; -import config from '../../src/lib/config.js'; -import { getUserAgent } from '../../src/lib/readmeAPIFetch.js'; +import config from "../../src/lib/config.js"; +import { getUserAgent } from "../../src/lib/readmeAPIFetch.js"; -import { mockVersion } from './oclif.js'; +import { mockVersion } from "./oclif.js"; /** * Nock wrapper for ReadMe API v1 that adds required @@ -12,7 +12,7 @@ import { mockVersion } from './oclif.js'; export function getAPIv1Mock(reqHeaders = {}) { return nock(config.host.v1, { reqheaders: { - 'User-Agent': getUserAgent(), + "User-Agent": getUserAgent(), ...reqHeaders, }, }); @@ -22,11 +22,11 @@ export function getAPIv1Mock(reqHeaders = {}) { * Nock wrapper for ReadMe API v2 that adds required * `user-agent` request header so it gets properly picked up by nock. */ -export function getAPIv2Mock(reqHeaders: nock.Options['reqheaders'] = {}) { +export function getAPIv2Mock(reqHeaders: nock.Options["reqheaders"] = {}) { return nock(config.host.v2, { reqheaders: { - 'User-Agent': ua => ua.startsWith(`rdme/${mockVersion}`), - 'x-readme-source': 'cli', + "User-Agent": (ua) => ua.startsWith(`rdme/${mockVersion}`), + "x-readme-source": "cli", ...reqHeaders, }, }); @@ -35,10 +35,10 @@ export function getAPIv2Mock(reqHeaders: nock.Options['reqheaders'] = {}) { /** * Variant of `getAPIv2Mock` for mocking a GitHub Actions environment. */ -export function getAPIv2MockForGHA(reqHeaders: nock.Options['reqheaders'] = {}) { +export function getAPIv2MockForGHA(reqHeaders: nock.Options["reqheaders"] = {}) { return getAPIv2Mock({ - 'User-Agent': ua => ua.startsWith(`rdme-github/${mockVersion}`), - 'x-readme-source': 'cli-gh', + "User-Agent": (ua) => ua.startsWith(`rdme-github/${mockVersion}`), + "x-readme-source": "cli-gh", ...reqHeaders, }); }