Skip to content

Commit

Permalink
test: adjust other test files for new mocked ids
Browse files Browse the repository at this point in the history
  • Loading branch information
axe312ger committed Sep 27, 2024
1 parent efdb0ce commit b88650e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 17 deletions.
6 changes: 3 additions & 3 deletions test/unit/create-environment-template-api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { createEnvironmentTemplateApi } from '../../lib/create-environment-templ
import { makeLink } from '../utils'

const organizationId = 'test-organization-id'
const spaceId = 'mockSpaceId'
const spaceId = 'mock-space-id'
const environmentId = 'mockEnvironment'

function setup<T>(promise: Promise<T>) {
Expand Down Expand Up @@ -95,7 +95,7 @@ describe('createEnvironmentTemplateApi', () => {
{
sys: {
...environmentTemplateInstallationMock.sys,
space: makeLink('Space', 'anotherMockSpaceId'),
space: makeLink('Space', 'anothermock-space-id'),
},
},
]
Expand Down Expand Up @@ -123,7 +123,7 @@ describe('createEnvironmentTemplateApi', () => {
{
sys: {
...environmentTemplateInstallationMock.sys,
space: makeLink('Space', 'anotherMockSpaceId'),
space: makeLink('Space', 'anothermock-space-id'),
},
},
]
Expand Down
5 changes: 3 additions & 2 deletions test/unit/entities/asset.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, test } from 'vitest'

import { cloneMock } from '../mocks/entities'
import setupMakeRequest from '../mocks/makeRequest'
import { wrapAsset, wrapAssetCollection } from '../../../lib/entities/asset'
Expand All @@ -15,7 +17,6 @@ import {
isPublishedTest,
isUpdatedTest,
} from '../test-creators/instance-entity-methods'
import { describe, test } from 'vitest'

function setup(promise) {
return {
Expand All @@ -24,7 +25,7 @@ function setup(promise) {
}
}

describe('Entity Asset', () => {
describe('Entity Asset', { concurrent: true }, () => {
test('Asset is wrapped', async () => {
return entityWrappedTest(setup, {
wrapperMethod: wrapAsset,
Expand Down
33 changes: 21 additions & 12 deletions test/unit/plain/webhook.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@ describe('Webhook', () => {
expect(response).to.be.an('object')
expect(response.redactedValue).to.equal('abcd')

expect(httpMock.get).toHaveBeenCalledWith(`/spaces/space-id/webhook_settings/signing_secret`, {
baseURL: 'https://api.contentful.com',
})
expect(httpMock.get).toHaveBeenCalledWith(
`/spaces/mock-space-id/webhook_settings/signing_secret`,
{
baseURL: 'https://api.contentful.com',
}
)
})

test('upsertSigningSecret', async () => {
Expand All @@ -36,7 +39,7 @@ describe('Webhook', () => {
expect(response.redactedValue).to.equal('abcd')

expect(httpMock.put).toHaveBeenCalledWith(
`/spaces/space-id/webhook_settings/signing_secret`,
`/spaces/mock-space-id/webhook_settings/signing_secret`,
payload,
{
baseURL: 'https://api.contentful.com',
Expand All @@ -50,7 +53,7 @@ describe('Webhook', () => {
await plainClient.webhook.deleteSigningSecret({ spaceId })

expect(httpMock.delete).toHaveBeenCalledWith(
`/spaces/space-id/webhook_settings/signing_secret`,
`/spaces/mock-space-id/webhook_settings/signing_secret`,
{
baseURL: 'https://api.contentful.com',
}
Expand All @@ -67,9 +70,12 @@ describe('Webhook', () => {
expect(response).to.be.an('object')
expect(response.maxRetries).to.equal(15)

expect(httpMock.get).toHaveBeenCalledWith(`/spaces/space-id/webhook_settings/retry_policy`, {
baseURL: 'https://api.contentful.com',
})
expect(httpMock.get).toHaveBeenCalledWith(
`/spaces/mock-space-id/webhook_settings/retry_policy`,
{
baseURL: 'https://api.contentful.com',
}
)
})

test('upsertRetryPolicy', async () => {
Expand All @@ -85,7 +91,7 @@ describe('Webhook', () => {
expect(response.maxRetries).to.equal(15)

expect(httpMock.put).toHaveBeenCalledWith(
`/spaces/space-id/webhook_settings/retry_policy`,
`/spaces/mock-space-id/webhook_settings/retry_policy`,
payload,
{
baseURL: 'https://api.contentful.com',
Expand All @@ -98,8 +104,11 @@ describe('Webhook', () => {
const plainClient = createClient({ apiAdapter: adapterMock }, { type: 'plain' })
await plainClient.webhook.deleteRetryPolicy({ spaceId })

expect(httpMock.delete).toHaveBeenCalledWith(`/spaces/space-id/webhook_settings/retry_policy`, {
baseURL: 'https://api.contentful.com',
})
expect(httpMock.delete).toHaveBeenCalledWith(
`/spaces/mock-space-id/webhook_settings/retry_policy`,
{
baseURL: 'https://api.contentful.com',
}
)
})
})

0 comments on commit b88650e

Please sign in to comment.