Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

44 changes: 1 addition & 43 deletions __tests__/common/cloudflare/api/endpoints.test.ts
Original file line number Diff line number Diff line change
@@ -1,50 +1,8 @@
import {describe, expect, test} from 'vitest'

import {
getCloudflareApiEndpoint,
getCloudflareLogEndpoint
} from '@/common/cloudflare/api/endpoints.js'
import {getCloudflareLogEndpoint} from '@/common/cloudflare/api/endpoints.js'

describe('endpoints', () => {
describe(getCloudflareApiEndpoint, () => {
test('returns correct url', () => {
expect.assertions(1)

const url = getCloudflareApiEndpoint({
accountId: 'mock-cloudflare-account-id',
projectName: 'mock-cloudflare-project-name'
})

expect(url).toBe(
`https://api.cloudflare.com/client/v4/accounts/mock-cloudflare-account-id/pages/projects/mock-cloudflare-project-name`
)
})

test('appends path argument', () => {
expect.assertions(2)

const url = getCloudflareApiEndpoint({
path: 'mock-deployment',
accountId: 'mock-cloudflare-account-id',
projectName: 'mock-cloudflare-project-name'
})

expect(url).toBe(
`https://api.cloudflare.com/client/v4/accounts/mock-cloudflare-account-id/pages/projects/mock-cloudflare-project-name/mock-deployment`
)

const urlParams = getCloudflareApiEndpoint({
path: `deployments/${123}?force=true`,
accountId: 'mock-cloudflare-account-id',
projectName: 'mock-cloudflare-project-name'
})

expect(urlParams).toMatchInlineSnapshot(
'"https://api.cloudflare.com/client/v4/accounts/mock-cloudflare-account-id/pages/projects/mock-cloudflare-project-name/deployments/123?force=true"'
)
})
})

describe(getCloudflareLogEndpoint, () => {
test('returns correct url', () => {
expect.assertions(2)
Expand Down
71 changes: 0 additions & 71 deletions __tests__/common/cloudflare/api/fetch-error.test.ts

This file was deleted.

96 changes: 0 additions & 96 deletions __tests__/common/cloudflare/api/fetch-result.test.ts

This file was deleted.

5 changes: 2 additions & 3 deletions __tests__/common/cloudflare/deployment/create.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {info, setOutput, summary} from '@actions/core'
import Cloudflare from 'cloudflare'
import {afterEach, beforeEach, describe, expect, test, vi} from 'vitest'

import type {MockApi} from '@/tests/helpers/api.js'
Expand Down Expand Up @@ -118,9 +119,7 @@ describe(createCloudflareDeployment, () => {
projectName: 'mock-cloudflare-project-name',
directory: 'mock-directory'
})
).rejects.toThrowErrorMatchingInlineSnapshot(
`[ParseError: A request to the Cloudflare API (https://api.cloudflare.com/client/v4/accounts/mock-cloudflare-account-id/pages/projects/mock-cloudflare-project-name/deployments) failed.]`
)
).rejects.toBeInstanceOf(Cloudflare.APIError)
expect(execFileAsync).toHaveBeenCalledTimes(1)
expect(info).toHaveBeenLastCalledWith('success')
expect(setOutput).not.toHaveBeenCalled()
Expand Down
7 changes: 3 additions & 4 deletions __tests__/common/cloudflare/deployment/status.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import Cloudflare from 'cloudflare'
import {afterEach, beforeEach, describe, expect, test, vi} from 'vitest'

import type {PagesDeployment} from '@/common/cloudflare/types.js'
Expand Down Expand Up @@ -129,10 +130,8 @@ describe(statusCloudflareDeployment, () => {
404
)

await expect(
statusCloudflareDeployment(API_ENDPOINT)
).rejects.toThrowErrorMatchingInlineSnapshot(
`[ParseError: A request to the Cloudflare API (https://api.cloudflare.com/client/v4/accounts/mock-cloudflare-account-id/pages/projects/mock-cloudflare-project-name/deployments) failed.]`
await expect(statusCloudflareDeployment(API_ENDPOINT)).rejects.toBeInstanceOf(
Cloudflare.APIError
)
})
})
Loading
Loading