diff --git a/__tests__/commands/changelogs/index.test.ts b/__tests__/commands/changelogs/index.test.ts index f9eed6add..5e475b546 100644 --- a/__tests__/commands/changelogs/index.test.ts +++ b/__tests__/commands/changelogs/index.test.ts @@ -8,7 +8,7 @@ import { describe, beforeAll, afterAll, beforeEach, it, expect } from 'vitest'; import Command from '../../../src/commands/changelogs.js'; import { APIv1Error } from '../../../src/lib/apiError.js'; -import { getAPIv1Mock } from '../../helpers/get-api-mock.js'; +import { getAPIV1Mock } from '../../helpers/get-api-mock.js'; import hashFileContents from '../../helpers/hash-file-contents.js'; import { runCommandAndReturnResult } from '../../helpers/oclif.js'; @@ -67,7 +67,7 @@ describe('rdme changelogs', () => { it('should fetch changelog and merge with what is returned', () => { expect.assertions(1); - const getMocks = getAPIv1Mock() + const getMocks = getAPIV1Mock() .get('/api/v1/changelogs/simple-doc') .basicAuth({ user: key }) .reply(200, { slug: simpleDoc.slug, lastUpdatedHash: 'anOldHash' }) @@ -75,7 +75,7 @@ describe('rdme changelogs', () => { .basicAuth({ user: key }) .reply(200, { slug: anotherDoc.slug, lastUpdatedHash: 'anOldHash' }); - const updateMocks = getAPIv1Mock() + const updateMocks = getAPIV1Mock() .put('/api/v1/changelogs/simple-doc', { body: simpleDoc.doc.content, lastUpdatedHash: simpleDoc.hash, @@ -112,7 +112,7 @@ describe('rdme changelogs', () => { it('should return changelog update info for dry run', () => { expect.assertions(1); - const getMocks = getAPIv1Mock() + const getMocks = getAPIV1Mock() .get('/api/v1/changelogs/simple-doc') .basicAuth({ user: key }) .reply(200, { slug: simpleDoc.slug, lastUpdatedHash: 'anOldHash' }) @@ -141,7 +141,7 @@ describe('rdme changelogs', () => { it('should not send requests for changelogs that have not changed', () => { expect.assertions(1); - const getMocks = getAPIv1Mock() + const getMocks = getAPIV1Mock() .get('/api/v1/changelogs/simple-doc') .basicAuth({ user: key }) .reply(200, { slug: simpleDoc.slug, lastUpdatedHash: simpleDoc.hash }) @@ -164,7 +164,7 @@ describe('rdme changelogs', () => { it('should adjust "no changes" message if in dry run', () => { expect.assertions(1); - const getMocks = getAPIv1Mock() + const getMocks = getAPIV1Mock() .get('/api/v1/changelogs/simple-doc') .basicAuth({ user: key }) .reply(200, { slug: simpleDoc.slug, lastUpdatedHash: simpleDoc.hash }) @@ -192,7 +192,7 @@ describe('rdme changelogs', () => { const doc = frontMatter(fs.readFileSync(path.join(fullFixturesDir, `/new-docs/${slug}.md`))); const hash = hashFileContents(fs.readFileSync(path.join(fullFixturesDir, `/new-docs/${slug}.md`))); - const getMock = getAPIv1Mock() + const getMock = getAPIV1Mock() .get(`/api/v1/changelogs/${slug}`) .basicAuth({ user: key }) .reply(404, { @@ -202,7 +202,7 @@ describe('rdme changelogs', () => { help: 'If you need help, email support@readme.io and mention log "fake-metrics-uuid".', }); - const postMock = getAPIv1Mock() + const postMock = getAPIV1Mock() .post('/api/v1/changelogs', { slug, body: doc.content, ...doc.data, lastUpdatedHash: hash }) .basicAuth({ user: key }) .reply(201, { slug, _id: id, body: doc.content, ...doc.data, lastUpdatedHash: hash }); @@ -219,7 +219,7 @@ describe('rdme changelogs', () => { const slug = 'new-doc'; const doc = frontMatter(fs.readFileSync(path.join(fullFixturesDir, `/new-docs/${slug}.md`))); - const getMock = getAPIv1Mock() + const getMock = getAPIV1Mock() .get(`/api/v1/changelogs/${slug}`) .basicAuth({ user: key }) .reply(404, { @@ -254,7 +254,7 @@ describe('rdme changelogs', () => { const hash = hashFileContents(fs.readFileSync(path.join(fullFixturesDir, `/${folder}/${slug}.md`))); - const getMocks = getAPIv1Mock() + const getMocks = getAPIV1Mock() .get(`/api/v1/changelogs/${slug}`) .basicAuth({ user: key }) .reply(404, { @@ -264,7 +264,7 @@ describe('rdme changelogs', () => { help: 'If you need help, email support@readme.io and mention log "fake-metrics-uuid".', }); - const postMocks = getAPIv1Mock() + const postMocks = getAPIV1Mock() .post('/api/v1/changelogs', { slug, body: doc.content, ...doc.data, lastUpdatedHash: hash }) .basicAuth({ user: key }) .reply(400, errorObject); @@ -292,7 +292,7 @@ describe('rdme changelogs', () => { const doc = frontMatter(fs.readFileSync(path.join(fullFixturesDir, `/slug-docs/${slug}.md`))); const hash = hashFileContents(fs.readFileSync(path.join(fullFixturesDir, `/slug-docs/${slug}.md`))); - const getMock = getAPIv1Mock() + const getMock = getAPIV1Mock() .get(`/api/v1/changelogs/${doc.data.slug}`) .basicAuth({ user: key }) .reply(404, { @@ -302,7 +302,7 @@ describe('rdme changelogs', () => { help: 'If you need help, email support@readme.io and mention log "fake-metrics-uuid".', }); - const postMock = getAPIv1Mock() + const postMock = getAPIV1Mock() .post('/api/v1/changelogs', { slug, body: doc.content, ...doc.data, lastUpdatedHash: hash }) .basicAuth({ user: key }) .reply(201, { slug: doc.data.slug, _id: id, body: doc.content, ...doc.data, lastUpdatedHash: hash }); diff --git a/__tests__/commands/changelogs/single.test.ts b/__tests__/commands/changelogs/single.test.ts index 1d85743a7..be6356eca 100644 --- a/__tests__/commands/changelogs/single.test.ts +++ b/__tests__/commands/changelogs/single.test.ts @@ -8,7 +8,7 @@ import { describe, beforeAll, afterAll, beforeEach, it, expect } from 'vitest'; import Command from '../../../src/commands/changelogs.js'; import { APIv1Error } from '../../../src/lib/apiError.js'; -import { getAPIv1Mock } from '../../helpers/get-api-mock.js'; +import { getAPIV1Mock } from '../../helpers/get-api-mock.js'; import hashFileContents from '../../helpers/hash-file-contents.js'; import { runCommandAndReturnResult } from '../../helpers/oclif.js'; @@ -49,7 +49,7 @@ describe('rdme changelogs (single)', () => { const doc = frontMatter(fs.readFileSync(path.join(fullFixturesDir, `/new-docs/${slug}.md`))); const hash = hashFileContents(fs.readFileSync(path.join(fullFixturesDir, `/new-docs/${slug}.md`))); - const getMock = getAPIv1Mock() + const getMock = getAPIV1Mock() .get(`/api/v1/changelogs/${slug}`) .basicAuth({ user: key }) .reply(404, { @@ -59,7 +59,7 @@ describe('rdme changelogs (single)', () => { help: 'If you need help, email support@readme.io and mention log "fake-metrics-uuid".', }); - const postMock = getAPIv1Mock() + const postMock = getAPIV1Mock() .post('/api/v1/changelogs', { slug, body: doc.content, ...doc.data, lastUpdatedHash: hash }) .basicAuth({ user: key }) .reply(201, { slug, _id: id, body: doc.content, ...doc.data }); @@ -76,7 +76,7 @@ describe('rdme changelogs (single)', () => { const slug = 'new-doc'; const doc = frontMatter(fs.readFileSync(path.join(fullFixturesDir, `/new-docs/${slug}.md`))); - const getMock = getAPIv1Mock() + const getMock = getAPIV1Mock() .get(`/api/v1/changelogs/${slug}`) .basicAuth({ user: key }) .reply(404, { @@ -113,7 +113,7 @@ describe('rdme changelogs (single)', () => { help: 'If you need help, email support@readme.io and mention log "fake-metrics-uuid".', }; - const getMock = getAPIv1Mock().get(`/api/v1/changelogs/${slug}`).basicAuth({ user: key }).reply(500, errorObject); + const getMock = getAPIV1Mock().get(`/api/v1/changelogs/${slug}`).basicAuth({ user: key }).reply(500, errorObject); const filePath = `./__tests__/${fixturesBaseDir}/failure-docs/${slug}.md`; @@ -135,7 +135,7 @@ describe('rdme changelogs (single)', () => { const doc = frontMatter(fs.readFileSync(path.join(fullFixturesDir, `/slug-docs/${slug}.md`))); const hash = hashFileContents(fs.readFileSync(path.join(fullFixturesDir, `/slug-docs/${slug}.md`))); - const getMock = getAPIv1Mock() + const getMock = getAPIV1Mock() .get(`/api/v1/changelogs/${doc.data.slug}`) .basicAuth({ user: key }) .reply(404, { @@ -145,7 +145,7 @@ describe('rdme changelogs (single)', () => { help: 'If you need help, email support@readme.io and mention log "fake-metrics-uuid".', }); - const postMock = getAPIv1Mock() + const postMock = getAPIV1Mock() .post('/api/v1/changelogs', { slug, body: doc.content, ...doc.data, lastUpdatedHash: hash }) .basicAuth({ user: key }) .reply(201, { slug: doc.data.slug, _id: id, body: doc.content, ...doc.data, lastUpdatedHash: hash }); @@ -172,12 +172,12 @@ describe('rdme changelogs (single)', () => { }); it('should fetch changelog and merge with what is returned', () => { - const getMock = getAPIv1Mock() + const getMock = getAPIV1Mock() .get('/api/v1/changelogs/simple-doc') .basicAuth({ user: key }) .reply(200, { slug: simpleDoc.slug, lastUpdatedHash: 'anOldHash' }); - const updateMock = getAPIv1Mock() + const updateMock = getAPIV1Mock() .put('/api/v1/changelogs/simple-doc', { body: simpleDoc.doc.content, lastUpdatedHash: simpleDoc.hash, @@ -202,7 +202,7 @@ describe('rdme changelogs (single)', () => { it('should return changelog update info for dry run', () => { expect.assertions(1); - const getMock = getAPIv1Mock() + const getMock = getAPIV1Mock() .get('/api/v1/changelogs/simple-doc') .basicAuth({ user: key }) .reply(200, { slug: simpleDoc.slug, lastUpdatedHash: 'anOldHash' }); @@ -227,7 +227,7 @@ describe('rdme changelogs (single)', () => { it('should not send requests for changelogs that have not changed', () => { expect.assertions(1); - const getMock = getAPIv1Mock() + const getMock = getAPIV1Mock() .get('/api/v1/changelogs/simple-doc') .basicAuth({ user: key }) .reply(200, { slug: simpleDoc.slug, lastUpdatedHash: simpleDoc.hash }); @@ -240,7 +240,7 @@ describe('rdme changelogs (single)', () => { }); it('should adjust "no changes" message if in dry run', () => { - const getMock = getAPIv1Mock() + const getMock = getAPIV1Mock() .get('/api/v1/changelogs/simple-doc') .basicAuth({ user: key }) .reply(200, { slug: simpleDoc.slug, lastUpdatedHash: simpleDoc.hash }); diff --git a/__tests__/commands/login.test.ts b/__tests__/commands/login.test.ts index e7f559c54..24d09c400 100644 --- a/__tests__/commands/login.test.ts +++ b/__tests__/commands/login.test.ts @@ -5,7 +5,7 @@ import { describe, beforeAll, afterAll, afterEach, it, expect } from 'vitest'; import Command from '../../src/commands/login.js'; import { APIv1Error } from '../../src/lib/apiError.js'; import configStore from '../../src/lib/configstore.js'; -import { getAPIv1Mock } from '../helpers/get-api-mock.js'; +import { getAPIV1Mock } from '../helpers/get-api-mock.js'; import { runCommandAndReturnResult } from '../helpers/oclif.js'; const apiKey = 'abcdefg'; @@ -39,7 +39,7 @@ describe('rdme login', () => { it('should post to /login on the API', async () => { prompts.inject([email, password, project]); - const mock = getAPIv1Mock().post('/api/v1/login', { email, password, project }).reply(200, { apiKey }); + const mock = getAPIV1Mock().post('/api/v1/login', { email, password, project }).reply(200, { apiKey }); await expect(run()).resolves.toBe('Successfully logged in as user@example.com to the subdomain project.'); @@ -53,7 +53,7 @@ describe('rdme login', () => { it('should post to /login on the API if passing in project via opt', async () => { prompts.inject([email, password]); - const mock = getAPIv1Mock().post('/api/v1/login', { email, password, project }).reply(200, { apiKey }); + const mock = getAPIV1Mock().post('/api/v1/login', { email, password, project }).reply(200, { apiKey }); await expect(run(['--project', project])).resolves.toBe( 'Successfully logged in as user@example.com to the subdomain project.', @@ -67,7 +67,7 @@ describe('rdme login', () => { }); it('should bypass prompts and post to /login on the API if passing in every opt', async () => { - const mock = getAPIv1Mock().post('/api/v1/login', { email, password, project, token }).reply(200, { apiKey }); + const mock = getAPIV1Mock().post('/api/v1/login', { email, password, project, token }).reply(200, { apiKey }); await expect(run(['--email', email, '--password', password, '--project', project, '--otp', token])).resolves.toBe( 'Successfully logged in as user@example.com to the subdomain project.', @@ -81,7 +81,7 @@ describe('rdme login', () => { }); it('should bypass prompts and post to /login on the API if passing in every opt (no 2FA)', async () => { - const mock = getAPIv1Mock().post('/api/v1/login', { email, password, project }).reply(200, { apiKey }); + const mock = getAPIV1Mock().post('/api/v1/login', { email, password, project }).reply(200, { apiKey }); await expect(run(['--email', email, '--password', password, '--project', project])).resolves.toBe( 'Successfully logged in as user@example.com to the subdomain project.', @@ -103,7 +103,7 @@ describe('rdme login', () => { help: 'If you need help, email support@readme.io and mention log "fake-metrics-uuid".', }; - const mock = getAPIv1Mock().post('/api/v1/login', { email, password, project }).reply(401, errorResponse); + const mock = getAPIV1Mock().post('/api/v1/login', { email, password, project }).reply(401, errorResponse); await expect(run()).rejects.toStrictEqual(new APIv1Error(errorResponse)); mock.done(); @@ -118,7 +118,7 @@ describe('rdme login', () => { help: 'If you need help, email support@readme.io and mention log "fake-metrics-uuid".', }; - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .post('/api/v1/login', { email, password, project }) .reply(401, errorResponse) .post('/api/v1/login', { email, password, project, token }) @@ -143,7 +143,7 @@ describe('rdme login', () => { help: 'If you need help, email support@readme.io', }; - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .post('/api/v1/login', { email, password, project: projectThatIsNotYours }) .reply(404, errorResponse); diff --git a/__tests__/commands/openapi/index.test.ts b/__tests__/commands/openapi/index.test.ts index d013e4aa7..3a39557c4 100644 --- a/__tests__/commands/openapi/index.test.ts +++ b/__tests__/commands/openapi/index.test.ts @@ -11,7 +11,7 @@ import Command from '../../../src/commands/openapi/index.js'; import { APIv1Error } from '../../../src/lib/apiError.js'; import config from '../../../src/lib/config.js'; import petstoreWeird from '../../__fixtures__/petstore-simple-weird-version.json' with { type: 'json' }; -import { getAPIv1Mock, getAPIv1MockWithVersionHeader } from '../../helpers/get-api-mock.js'; +import { getAPIV1Mock, getAPIV1MockWithVersionHeader } from '../../helpers/get-api-mock.js'; import { after, before } from '../../helpers/get-gha-setup.js'; import { runCommandAndReturnResult } from '../../helpers/oclif.js'; import { after as afterGHAEnv, before as beforeGHAEnv } from '../../helpers/setup-gha-env.js'; @@ -88,7 +88,7 @@ describe('rdme openapi', () => { ])('should support uploading a %s definition (format: %s)', async (_, format, specVersion, type) => { const registryUUID = getRandomRegistryId(); - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .post('/api/v1/api-registry', body => body.match('form-data; name="spec"')) .reply(201, { registryUUID, spec: { openapi: specVersion } }) .get('/api/v1/api-specification') @@ -98,7 +98,7 @@ describe('rdme openapi', () => { .basicAuth({ user: key }) .reply(200, { version: '1.0.0' }); - const postMock = getAPIv1MockWithVersionHeader(version) + const postMock = getAPIV1MockWithVersionHeader(version) .post('/api/v1/api-specification', { registryUUID }) .basicAuth({ user: key }) .reply(201, { _id: 1 }, { location: exampleRefLocation }); @@ -122,14 +122,14 @@ describe('rdme openapi', () => { prompts.inject(['create']); const registryUUID = getRandomRegistryId(); - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .get(`/api/v1/version/${version}`) .basicAuth({ user: key }) .reply(200, { version }) .post('/api/v1/api-registry', body => body.match('form-data; name="spec"')) .reply(201, { registryUUID, spec: { openapi: '3.0.0' } }); - const mockWithHeader = getAPIv1MockWithVersionHeader(version) + const mockWithHeader = getAPIV1MockWithVersionHeader(version) .get('/api/v1/api-specification') .basicAuth({ user: key }) .reply(200, [{ _id: 'spec1', title: 'spec1_title' }]) @@ -148,14 +148,14 @@ describe('rdme openapi', () => { it('should create a new spec via `--create` flag', async () => { const registryUUID = getRandomRegistryId(); - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .get(`/api/v1/version/${version}`) .basicAuth({ user: key }) .reply(200, { version }) .post('/api/v1/api-registry', body => body.match('form-data; name="spec"')) .reply(201, { registryUUID, spec: { openapi: '3.0.0' } }); - const postMock = getAPIv1MockWithVersionHeader(version) + const postMock = getAPIV1MockWithVersionHeader(version) .post('/api/v1/api-specification', { registryUUID }) .basicAuth({ user: key }) .reply(201, { _id: 1 }, { location: exampleRefLocation }); @@ -171,14 +171,14 @@ describe('rdme openapi', () => { it('should create a new spec via `--create` flag and ignore `--id`', async () => { const registryUUID = getRandomRegistryId(); - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .get('/api/v1/version') .basicAuth({ user: key }) .reply(200, [{ version }]) .post('/api/v1/api-registry', body => body.match('form-data; name="spec"')) .reply(201, { registryUUID, spec: { openapi: '3.0.0' } }); - const postMock = getAPIv1MockWithVersionHeader(version) + const postMock = getAPIV1MockWithVersionHeader(version) .post('/api/v1/api-specification', { registryUUID }) .basicAuth({ user: key }) .reply(201, { _id: 1 }, { location: exampleRefLocation }); @@ -201,7 +201,7 @@ describe('rdme openapi', () => { it('should bundle and upload the expected content', async () => { let requestBody; const registryUUID = getRandomRegistryId(); - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .get(`/api/v1/version/${version}`) .basicAuth({ user: key }) .reply(200, { version: '1.0.0' }) @@ -216,7 +216,7 @@ describe('rdme openapi', () => { .basicAuth({ user: key }) .reply(200, []); - const postMock = getAPIv1MockWithVersionHeader(version) + const postMock = getAPIV1MockWithVersionHeader(version) .post('/api/v1/api-specification', { registryUUID }) .basicAuth({ user: key }) .reply(201, { _id: 1 }, { location: exampleRefLocation }); @@ -237,7 +237,7 @@ describe('rdme openapi', () => { let requestBody; const registryUUID = getRandomRegistryId(); const title = 'some alternative title'; - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .get(`/api/v1/version/${version}`) .basicAuth({ user: key }) .reply(200, { version: '1.0.0' }) @@ -252,7 +252,7 @@ describe('rdme openapi', () => { .basicAuth({ user: key }) .reply(200, []); - const postMock = getAPIv1MockWithVersionHeader(version) + const postMock = getAPIV1MockWithVersionHeader(version) .post('/api/v1/api-specification', { registryUUID }) .basicAuth({ user: key }) .reply(201, { _id: 1 }, { location: exampleRefLocation }); @@ -274,7 +274,7 @@ describe('rdme openapi', () => { it('should upload the expected content and return raw output', async () => { let requestBody; const registryUUID = getRandomRegistryId(); - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .get(`/api/v1/version/${version}`) .basicAuth({ user: key }) .reply(200, { version: '1.0.0' }) @@ -289,7 +289,7 @@ describe('rdme openapi', () => { .basicAuth({ user: key }) .reply(200, []); - const postMock = getAPIv1MockWithVersionHeader(version) + const postMock = getAPIV1MockWithVersionHeader(version) .post('/api/v1/api-specification', { registryUUID }) .basicAuth({ user: key }) .reply(201, { _id: 1 }, { location: exampleRefLocation }); @@ -314,11 +314,11 @@ describe('rdme openapi', () => { ])('should support updating a %s definition (format: %s)', async (_, format, specVersion, type) => { const registryUUID = getRandomRegistryId(); - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .post('/api/v1/api-registry', body => body.match('form-data; name="spec"')) .reply(201, { registryUUID, spec: { openapi: specVersion } }); - const putMock = getAPIv1MockWithVersionHeader(version) + const putMock = getAPIV1MockWithVersionHeader(version) .put(`/api/v1/api-specification/${id}`, { registryUUID }) .basicAuth({ user: key }) .reply(201, { _id: 1 }, { location: exampleRefLocation }); @@ -337,11 +337,11 @@ describe('rdme openapi', () => { expect.assertions(4); const registryUUID = getRandomRegistryId(); - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .post('/api/v1/api-registry', body => body.match('form-data; name="spec"')) .reply(201, { registryUUID, spec: { openapi: '3.0.0' } }); - const putMock = getAPIv1MockWithVersionHeader(version) + const putMock = getAPIV1MockWithVersionHeader(version) .put(`/api/v1/api-specification/${id}`, { registryUUID }) .basicAuth({ user: key }) .reply(201, { _id: 1 }, { location: exampleRefLocation }); @@ -365,14 +365,14 @@ describe('rdme openapi', () => { prompts.inject(['update', 'spec2']); const registryUUID = getRandomRegistryId(); - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .get(`/api/v1/version/${version}`) .basicAuth({ user: key }) .reply(200, { version }) .post('/api/v1/api-registry', body => body.match('form-data; name="spec"')) .reply(201, { registryUUID, spec: { openapi: '3.0.0' } }); - const mockWithHeader = getAPIv1MockWithVersionHeader(version) + const mockWithHeader = getAPIV1MockWithVersionHeader(version) .get('/api/v1/api-specification') .basicAuth({ user: key }) .reply(200, [ @@ -394,7 +394,7 @@ describe('rdme openapi', () => { it('should discover and upload an API definition if none is provided', async () => { const registryUUID = getRandomRegistryId(); - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .get(`/api/v1/version/${version}`) .basicAuth({ user: key }) .reply(200, { version }) @@ -406,7 +406,7 @@ describe('rdme openapi', () => { .basicAuth({ user: key }) .reply(200, []); - const postMock = getAPIv1MockWithVersionHeader(version) + const postMock = getAPIV1MockWithVersionHeader(version) .post('/api/v1/api-specification', { registryUUID }) .basicAuth({ user: key }) .reply(201, { _id: 1 }, { location: exampleRefLocation }); @@ -430,7 +430,7 @@ describe('rdme openapi', () => { let requestBody; const registryUUID = getRandomRegistryId(); - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .get(`/api/v1/version/${version}`) .basicAuth({ user: key }) .reply(200, { version }) @@ -445,7 +445,7 @@ describe('rdme openapi', () => { .basicAuth({ user: key }) .reply(200, []); - const postMock = getAPIv1MockWithVersionHeader(version) + const postMock = getAPIV1MockWithVersionHeader(version) .post('/api/v1/api-specification', { registryUUID }) .basicAuth({ user: key }) .reply(201, { _id: 1 }, { location: exampleRefLocation }); @@ -476,14 +476,14 @@ describe('rdme openapi', () => { prompts.inject(['update', 'spec2']); const registryUUID = getRandomRegistryId(); - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .get(`/api/v1/version/${version}`) .basicAuth({ user: key }) .reply(200, { version }) .post('/api/v1/api-registry', body => body.match('form-data; name="spec"')) .reply(201, { registryUUID, spec: { openapi: '3.0.0' } }); - const mockWithHeader = getAPIv1MockWithVersionHeader(version) + const mockWithHeader = getAPIV1MockWithVersionHeader(version) .get('/api/v1/api-specification') .basicAuth({ user: key }) .reply(200, [ @@ -504,7 +504,7 @@ describe('rdme openapi', () => { it('should return spec create info for dry run (with working directory)', async () => { const registryUUID = getRandomRegistryId(); - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .get(`/api/v1/version/${version}`) .basicAuth({ user: key }) .reply(200, { version }) @@ -542,14 +542,14 @@ describe('rdme openapi', () => { it("should update a spec file without prompts if providing `update` and it's the one spec available", async () => { const registryUUID = getRandomRegistryId(); - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .get(`/api/v1/version/${version}`) .basicAuth({ user: key }) .reply(200, { version }) .post('/api/v1/api-registry', body => body.match('form-data; name="spec"')) .reply(201, { registryUUID, spec: { openapi: '3.0.0' } }); - const mockWithHeader = getAPIv1MockWithVersionHeader(version) + const mockWithHeader = getAPIV1MockWithVersionHeader(version) .get('/api/v1/api-specification') .basicAuth({ user: key }) .reply(200, [{ _id: 'spec1', title: 'spec1_title' }]) @@ -568,7 +568,7 @@ describe('rdme openapi', () => { it('should error if providing `update` and there are multiple specs available', async () => { const registryUUID = getRandomRegistryId(); - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .get(`/api/v1/version/${version}`) .basicAuth({ user: key }) .reply(200, { version }) @@ -595,7 +595,7 @@ describe('rdme openapi', () => { expect.assertions(5); const registryUUID = getRandomRegistryId(); - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .post('/api/v1/api-registry', body => body.match('form-data; name="spec"')) .reply(201, { registryUUID, spec: { openapi: '3.0.0' } }) .put('/api/v1/api-specification/spec1', { registryUUID }) @@ -626,7 +626,7 @@ describe('rdme openapi', () => { expect.assertions(2); let requestBody = ''; const registryUUID = getRandomRegistryId(); - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .get(`/api/v1/version/${version}`) .basicAuth({ user: key }) .reply(200, { version: '1.0.0' }) @@ -638,7 +638,7 @@ describe('rdme openapi', () => { }) .reply(201, { registryUUID, spec: { openapi: '3.0.0' } }); - const mockWithHeader = getAPIv1MockWithVersionHeader(version) + const mockWithHeader = getAPIV1MockWithVersionHeader(version) .get('/api/v1/api-specification') .basicAuth({ user: key }) .reply(200, []) @@ -662,7 +662,7 @@ describe('rdme openapi', () => { const specVersion = '1.2.3'; let requestBody = ''; const registryUUID = getRandomRegistryId(); - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .get(`/api/v1/version/${specVersion}`) .basicAuth({ user: key }) .reply(200, { version: specVersion }) @@ -674,7 +674,7 @@ describe('rdme openapi', () => { }) .reply(201, { registryUUID, spec: { openapi: '3.0.0' } }); - const mockWithHeader = getAPIv1MockWithVersionHeader(specVersion) + const mockWithHeader = getAPIV1MockWithVersionHeader(specVersion) .get('/api/v1/api-specification') .basicAuth({ user: key }) .reply(200, []) @@ -708,7 +708,7 @@ describe('rdme openapi', () => { expect.assertions(2); let requestBody = ''; const registryUUID = getRandomRegistryId(); - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .post('/api/v1/api-registry', body => { requestBody = body.substring(body.indexOf('{'), body.lastIndexOf('}') + 1); requestBody = JSON.parse(requestBody); @@ -752,7 +752,7 @@ describe('rdme openapi', () => { ], }; - const mock = getAPIv1Mock().get(`/api/v1/version/${invalidVersion}`).reply(404, errorObject); + const mock = getAPIV1Mock().get(`/api/v1/version/${invalidVersion}`).reply(404, errorObject); await expect( run([ @@ -773,14 +773,14 @@ describe('rdme openapi', () => { const registryUUID = getRandomRegistryId(); - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .get('/api/v1/version') .basicAuth({ user: key }) .reply(200, [{ version: '1.0.0' }, { version: '1.0.1' }]) .post('/api/v1/api-registry', body => body.match('form-data; name="spec"')) .reply(201, { registryUUID, spec: { openapi: '3.0.0' } }); - const mockWithHeader = getAPIv1MockWithVersionHeader(selectedVersion) + const mockWithHeader = getAPIV1MockWithVersionHeader(selectedVersion) .get('/api/v1/api-specification') .basicAuth({ user: key }) .reply(200, []) @@ -820,7 +820,7 @@ describe('rdme openapi', () => { ], }; - const mock = getAPIv1Mock().get('/api/v1/version').reply(401, errorObject); + const mock = getAPIV1Mock().get('/api/v1/version').reply(401, errorObject); await expect( run([require.resolve('@readme/oas-examples/3.1/json/petstore.json'), '--key', 'key']), @@ -857,14 +857,14 @@ describe('rdme openapi', () => { const registryUUID = getRandomRegistryId(); - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .get(`/api/v1/version/${version}`) .basicAuth({ user: key }) .reply(200, { version: '1.0.0' }) .post('/api/v1/api-registry', body => body.match('form-data; name="spec"')) .reply(201, { registryUUID, spec: { openapi: '3.0.0' } }); - const mockWithHeader = getAPIv1MockWithVersionHeader(version) + const mockWithHeader = getAPIV1MockWithVersionHeader(version) .get('/api/v1/api-specification') .basicAuth({ user: key }) .reply(200, []) @@ -890,11 +890,11 @@ describe('rdme openapi', () => { const registryUUID = getRandomRegistryId(); - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .post('/api/v1/api-registry', body => body.match('form-data; name="spec"')) .reply(201, { registryUUID, spec: { openapi: '3.0.0' } }); - const putMock = getAPIv1MockWithVersionHeader(version) + const putMock = getAPIV1MockWithVersionHeader(version) .put(`/api/v1/api-specification/${id}`, { registryUUID }) .basicAuth({ user: key }) .reply(400, errorObject); @@ -923,7 +923,7 @@ describe('rdme openapi', () => { help: 'If you need help, email support@readme.io and mention log "fake-metrics-uuid".', }; - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .get(`/api/v1/version/${version}`) .basicAuth({ user: key }) .reply(200, { version: '1.0.0' }) @@ -948,14 +948,14 @@ describe('rdme openapi', () => { const registryUUID = getRandomRegistryId(); - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .get(`/api/v1/version/${version}`) .basicAuth({ user: key }) .reply(200, { version: '1.0.0' }) .post('/api/v1/api-registry', body => body.match('form-data; name="spec"')) .reply(201, { registryUUID, spec: { openapi: '3.0.0' } }); - const mockWithHeader = getAPIv1MockWithVersionHeader(version) + const mockWithHeader = getAPIV1MockWithVersionHeader(version) .get('/api/v1/api-specification') .basicAuth({ user: key }) .reply(200, []) @@ -974,14 +974,14 @@ describe('rdme openapi', () => { it('should error if API errors (generic upload error)', async () => { const registryUUID = getRandomRegistryId(); - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .get(`/api/v1/version/${version}`) .basicAuth({ user: key }) .reply(200, { version: '1.0.0' }) .post('/api/v1/api-registry', body => body.match('form-data; name="spec"')) .reply(201, { registryUUID, spec: { openapi: '3.0.0' } }); - const mockWithHeader = getAPIv1MockWithVersionHeader(version) + const mockWithHeader = getAPIV1MockWithVersionHeader(version) .get('/api/v1/api-specification') .basicAuth({ user: key }) .reply(200, []) @@ -1004,14 +1004,14 @@ describe('rdme openapi', () => { it('should error if API errors (request timeout)', async () => { const registryUUID = getRandomRegistryId(); - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .get(`/api/v1/version/${version}`) .basicAuth({ user: key }) .reply(200, { version: '1.0.0' }) .post('/api/v1/api-registry', body => body.match('form-data; name="spec"')) .reply(201, { registryUUID, spec: { openapi: '3.0.0' } }); - const mockWithHeader = getAPIv1MockWithVersionHeader(version) + const mockWithHeader = getAPIV1MockWithVersionHeader(version) .get('/api/v1/api-specification') .basicAuth({ user: key }) .reply(200, []) @@ -1059,14 +1059,14 @@ describe('rdme openapi', () => { prompts.inject(['create', true, 'openapi-branch', yamlFileName]); const registryUUID = getRandomRegistryId(); - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .get(`/api/v1/version/${version}`) .basicAuth({ user: key }) .reply(200, { version }) .post('/api/v1/api-registry', body => body.match('form-data; name="spec"')) .reply(201, { registryUUID, spec: { openapi: '3.0.0' } }); - const mockWithHeader = getAPIv1MockWithVersionHeader(version) + const mockWithHeader = getAPIV1MockWithVersionHeader(version) .get('/api/v1/api-specification') .basicAuth({ user: key }) .reply(200, [{ _id: 'spec1', title: 'spec1_title' }]) @@ -1095,14 +1095,14 @@ describe('rdme openapi', () => { prompts.inject(['create', 'openapi-branch-github-flag', yamlFileName]); const registryUUID = getRandomRegistryId(); - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .get(`/api/v1/version/${version}`) .basicAuth({ user: key }) .reply(200, { version }) .post('/api/v1/api-registry', body => body.match('form-data; name="spec"')) .reply(201, { registryUUID, spec: { openapi: '3.0.0' } }); - const mockWithHeader = getAPIv1MockWithVersionHeader(version) + const mockWithHeader = getAPIV1MockWithVersionHeader(version) .get('/api/v1/api-specification') .basicAuth({ user: key }) .reply(200, [{ _id: 'spec1', title: 'spec1_title' }]) @@ -1131,14 +1131,14 @@ describe('rdme openapi', () => { prompts.inject(['update', 'spec2', true, 'openapi-branch-update-prompt', yamlFileName]); const registryUUID = getRandomRegistryId(); - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .get(`/api/v1/version/${version}`) .basicAuth({ user: key }) .reply(200, { version }) .post('/api/v1/api-registry', body => body.match('form-data; name="spec"')) .reply(201, { registryUUID, spec: { openapi: '3.0.0' } }); - const mockWithHeader = getAPIv1MockWithVersionHeader(version) + const mockWithHeader = getAPIV1MockWithVersionHeader(version) .get('/api/v1/api-specification') .basicAuth({ user: key }) .reply(200, [ @@ -1167,14 +1167,14 @@ describe('rdme openapi', () => { prompts.inject([true, 'openapi-branch-create-flag', yamlFileName]); const registryUUID = getRandomRegistryId(); - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .get(`/api/v1/version/${altVersion}`) .basicAuth({ user: key }) .reply(200, { version: altVersion }) .post('/api/v1/api-registry', body => body.match('form-data; name="spec"')) .reply(201, { registryUUID, spec: { openapi: '3.0.0' } }); - const mockWithHeader = getAPIv1MockWithVersionHeader(altVersion) + const mockWithHeader = getAPIV1MockWithVersionHeader(altVersion) .post('/api/v1/api-specification', { registryUUID }) .basicAuth({ user: key }) .reply(201, { _id: 1 }, { location: exampleRefLocation }); @@ -1196,14 +1196,14 @@ describe('rdme openapi', () => { prompts.inject([version, true, 'openapi-branch-create-flag-id-opt', yamlFileName]); const registryUUID = getRandomRegistryId(); - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .get('/api/v1/version') .basicAuth({ user: key }) .reply(200, [{ version }, { version: '1.1.0' }]) .post('/api/v1/api-registry', body => body.match('form-data; name="spec"')) .reply(201, { registryUUID, spec: { openapi: '3.0.0' } }); - const postMock = getAPIv1MockWithVersionHeader(version) + const postMock = getAPIV1MockWithVersionHeader(version) .post('/api/v1/api-specification', { registryUUID }) .basicAuth({ user: key }) .reply(201, { _id: 1 }, { location: exampleRefLocation }); @@ -1225,14 +1225,14 @@ describe('rdme openapi', () => { prompts.inject([true, 'openapi-branch-update-flag', yamlFileName]); const registryUUID = getRandomRegistryId(); - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .get(`/api/v1/version/${version}`) .basicAuth({ user: key }) .reply(200, { version }) .post('/api/v1/api-registry', body => body.match('form-data; name="spec"')) .reply(201, { registryUUID, spec: { openapi: '3.0.0' } }); - const mockWithHeader = getAPIv1MockWithVersionHeader(version) + const mockWithHeader = getAPIV1MockWithVersionHeader(version) .get('/api/v1/api-specification') .basicAuth({ user: key }) .reply(200, [{ _id: 'spec1', title: 'spec1_title' }]) @@ -1256,7 +1256,7 @@ describe('rdme openapi', () => { prompts.inject([true, 'openapi-branch-workingdirectory', yamlFileName]); const registryUUID = getRandomRegistryId(); - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .get(`/api/v1/version/${version}`) .basicAuth({ user: key }) .reply(200, { version }) @@ -1268,7 +1268,7 @@ describe('rdme openapi', () => { .basicAuth({ user: key }) .reply(200, []); - const postMock = getAPIv1MockWithVersionHeader(version) + const postMock = getAPIV1MockWithVersionHeader(version) .post('/api/v1/api-specification', { registryUUID }) .basicAuth({ user: key }) .reply(201, { _id: 1 }, { location: exampleRefLocation }); @@ -1299,14 +1299,14 @@ describe('rdme openapi', () => { prompts.inject(['create', false]); const registryUUID = getRandomRegistryId(); - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .get(`/api/v1/version/${version}`) .basicAuth({ user: key }) .reply(200, { version }) .post('/api/v1/api-registry', body => body.match('form-data; name="spec"')) .reply(201, { registryUUID, spec: { openapi: '3.0.0' } }); - const mockWithHeader = getAPIv1MockWithVersionHeader(version) + const mockWithHeader = getAPIV1MockWithVersionHeader(version) .get('/api/v1/api-specification') .basicAuth({ user: key }) .reply(200, [{ _id: 'spec1', title: 'spec1_title' }]) @@ -1343,11 +1343,11 @@ describe('rdme openapi', () => { it('should send proper headers in GitHub Actions CI for local spec file', async () => { const registryUUID = getRandomRegistryId(); - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .post('/api/v1/api-registry', body => body.match('form-data; name="spec"')) .reply(201, { registryUUID }); - const putMock = getAPIv1Mock({ + const putMock = getAPIV1Mock({ 'x-rdme-ci': 'GitHub Actions (test)', 'x-readme-source': 'cli-gh', 'x-readme-source-url': @@ -1370,13 +1370,13 @@ describe('rdme openapi', () => { const registryUUID = getRandomRegistryId(); const spec = 'https://example.com/openapi.json'; - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .post('/api/v1/api-registry', body => body.match('form-data; name="spec"')) .reply(201, { registryUUID }); const exampleMock = nock('https://example.com').get('/openapi.json').reply(200, petstoreWeird); - const putMock = getAPIv1Mock({ + const putMock = getAPIV1Mock({ 'x-rdme-ci': 'GitHub Actions (test)', 'x-readme-source': 'cli-gh', 'x-readme-source-url': spec, @@ -1395,7 +1395,7 @@ describe('rdme openapi', () => { it('should contain request header with correct URL with working directory', async () => { const registryUUID = getRandomRegistryId(); - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .get(`/api/v1/version/${version}`) .basicAuth({ user: key }) .reply(200, { version }) @@ -1407,7 +1407,7 @@ describe('rdme openapi', () => { .basicAuth({ user: key }) .reply(200, []); - const postMock = getAPIv1Mock({ + const postMock = getAPIV1Mock({ 'x-rdme-ci': 'GitHub Actions (test)', 'x-readme-source': 'cli-gh', 'x-readme-source-url': diff --git a/__tests__/helpers/get-api-mock.ts b/__tests__/helpers/get-api-mock.ts index c8fc83ff9..8afd0c853 100644 --- a/__tests__/helpers/get-api-mock.ts +++ b/__tests__/helpers/get-api-mock.ts @@ -7,7 +7,7 @@ import { getUserAgent } from '../../src/lib/readmeAPIFetch.js'; * Nock wrapper for ReadMe API v1 that adds required * `user-agent` request header so it gets properly picked up by nock. */ -export function getAPIv1Mock(reqHeaders = {}) { +export function getAPIV1Mock(reqHeaders = {}) { return nock(config.host, { reqheaders: { 'User-Agent': getUserAgent(), @@ -16,8 +16,8 @@ export function getAPIv1Mock(reqHeaders = {}) { }); } -export function getAPIv1MockWithVersionHeader(v: string) { - return getAPIv1Mock({ +export function getAPIV1MockWithVersionHeader(v: string) { + return getAPIV1Mock({ 'x-readme-version': v, }); } diff --git a/__tests__/lib/fetch.test.ts b/__tests__/lib/fetch.test.ts index 261ec9929..356e15938 100644 --- a/__tests__/lib/fetch.test.ts +++ b/__tests__/lib/fetch.test.ts @@ -4,7 +4,7 @@ import { describe, beforeEach, afterEach, it, expect, vi, beforeAll, type MockIn import pkg from '../../package.json' with { type: 'json' }; import { cleanAPIv1Headers, handleAPIv1Res, readmeAPIv1Fetch } from '../../src/lib/readmeAPIFetch.js'; -import { getAPIv1Mock } from '../helpers/get-api-mock.js'; +import { getAPIV1Mock } from '../helpers/get-api-mock.js'; import { after, before } from '../helpers/setup-gha-env.js'; describe('#readmeAPIv1Fetch()', () => { @@ -22,7 +22,7 @@ describe('#readmeAPIv1Fetch()', () => { it('should have correct headers for requests in GitHub Action env', async () => { const key = 'API_KEY'; - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .get('/api/v1') .basicAuth({ user: key }) .reply(200, function () { @@ -49,7 +49,7 @@ describe('#readmeAPIv1Fetch()', () => { it('should include source URL header with simple path', async () => { const key = 'API_KEY'; - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .get('/api/v1') .basicAuth({ user: key }) .reply(200, function () { @@ -74,7 +74,7 @@ describe('#readmeAPIv1Fetch()', () => { it('should include source URL header with path that contains weird characters', async () => { const key = 'API_KEY'; - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .get('/api/v1') .basicAuth({ user: key }) .reply(200, function () { @@ -100,7 +100,7 @@ describe('#readmeAPIv1Fetch()', () => { const key = 'API_KEY'; vi.stubEnv('GITHUB_SERVER_URL', undefined); - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .get('/api/v1') .basicAuth({ user: key }) .reply(200, function () { @@ -123,7 +123,7 @@ describe('#readmeAPIv1Fetch()', () => { it('should include source URL header with relative path', async () => { const key = 'API_KEY'; - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .get('/api/v1') .basicAuth({ user: key }) .reply(200, function () { @@ -149,7 +149,7 @@ describe('#readmeAPIv1Fetch()', () => { const key = 'API_KEY'; const filePath = 'https://example.com/openapi.json'; - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .get('/api/v1') .basicAuth({ user: key }) .reply(200, function () { @@ -174,7 +174,7 @@ describe('#readmeAPIv1Fetch()', () => { it('should wrap all requests with standard user-agent and source headers', async () => { const key = 'API_KEY'; - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .get('/api/v1') .basicAuth({ user: key }) .reply(200, function () { @@ -197,7 +197,7 @@ describe('#readmeAPIv1Fetch()', () => { }); it('should make fetch call if no other request options are provided', async () => { - const mock = getAPIv1Mock() + const mock = getAPIV1Mock() .get('/api/v1/doesnt-need-auth') .reply(200, function () { return this.req.headers; @@ -231,7 +231,7 @@ describe('#readmeAPIv1Fetch()', () => { }); it('should not log anything if no warning header was passed', async () => { - const mock = getAPIv1Mock().get('/api/v1/some-warning').reply(200, undefined, { + const mock = getAPIV1Mock().get('/api/v1/some-warning').reply(200, undefined, { Warning: '', }); @@ -244,7 +244,7 @@ describe('#readmeAPIv1Fetch()', () => { }); it('should surface a single warning header', async () => { - const mock = getAPIv1Mock().get('/api/v1/some-warning').reply(200, undefined, { + const mock = getAPIV1Mock().get('/api/v1/some-warning').reply(200, undefined, { Warning: '199 - "some error"', }); @@ -257,7 +257,7 @@ describe('#readmeAPIv1Fetch()', () => { }); it('should surface multiple warning headers', async () => { - const mock = getAPIv1Mock().get('/api/v1/some-warning').reply(200, undefined, { + const mock = getAPIV1Mock().get('/api/v1/some-warning').reply(200, undefined, { Warning: '199 - "some error" 199 - "another error"', }); @@ -272,7 +272,7 @@ describe('#readmeAPIv1Fetch()', () => { }); it('should surface header content even if parsing fails', async () => { - const mock = getAPIv1Mock().get('/api/v1/some-warning').reply(200, undefined, { + const mock = getAPIV1Mock().get('/api/v1/some-warning').reply(200, undefined, { Warning: 'some garbage error', }); @@ -300,7 +300,7 @@ describe('#readmeAPIv1Fetch()', () => { vi.stubEnv('HTTPS_PROXY', proxy); - const mock = getAPIv1Mock({}).get('/api/v1/proxy').reply(200); + const mock = getAPIV1Mock({}).get('/api/v1/proxy').reply(200); await readmeAPIv1Fetch('/api/v1/proxy'); @@ -312,7 +312,7 @@ describe('#readmeAPIv1Fetch()', () => { vi.stubEnv('https_proxy', proxy); - const mock = getAPIv1Mock({}).get('/api/v1/proxy').reply(200); + const mock = getAPIV1Mock({}).get('/api/v1/proxy').reply(200); await readmeAPIv1Fetch('/api/v1/proxy'); @@ -324,7 +324,7 @@ describe('#readmeAPIv1Fetch()', () => { vi.stubEnv('https_proxy', proxy); - const mock = getAPIv1Mock({}).get('/api/v1/proxy').reply(200); + const mock = getAPIV1Mock({}).get('/api/v1/proxy').reply(200); await readmeAPIv1Fetch('/api/v1/proxy');