diff --git a/test/hooks/config.ts b/test/hooks/config.ts index 4ead416a4e..882afc2a35 100644 --- a/test/hooks/config.ts +++ b/test/hooks/config.ts @@ -1,6 +1,7 @@ import type { SanitizedConfig } from 'payload/config' -import { APIError } from '../../packages/payload/src/errors/index.js' +import { APIError } from 'payload/errors' + import { buildConfigWithDefaults } from '../buildConfigWithDefaults.js' import AfterOperation from './collections/AfterOperation/index.js' import ChainingHooks from './collections/ChainingHooks/index.js' diff --git a/test/hooks/int.spec.ts b/test/hooks/int.spec.ts index e935f59087..ec42772c07 100644 --- a/test/hooks/int.spec.ts +++ b/test/hooks/int.spec.ts @@ -116,7 +116,7 @@ describe('Hooks', () => { }) it('should save data generated with afterRead hooks in nested field structures', async () => { - const document: NestedAfterReadHook = await payload.create({ + const document = await payload.create({ collection: nestedAfterReadHooksSlug, data: { group: { diff --git a/test/localization-rtl/deepMerge.ts b/test/localization-rtl/deepMerge.ts index 098960913c..7c2c1ea205 100644 --- a/test/localization-rtl/deepMerge.ts +++ b/test/localization-rtl/deepMerge.ts @@ -17,7 +17,6 @@ export default function deepMerge(target: T, if (isObject(target) && isObject(source)) { Object.keys(source).forEach((key) => { if (isObject(source[key])) { - // @ts-expect-error if (!(key in target)) { Object.assign(output, { [key]: source[key] }) } else { diff --git a/test/plugin-nested-docs/e2e.spec.ts b/test/plugin-nested-docs/e2e.spec.ts index 6e866ed7ce..9751114e71 100644 --- a/test/plugin-nested-docs/e2e.spec.ts +++ b/test/plugin-nested-docs/e2e.spec.ts @@ -22,27 +22,10 @@ let parentId: string let draftChildId: string let childId: string -type Args = { - parent?: string - slug: string - status?: 'draft' | 'published' - title?: string -} - -async function createPage({ - slug, - title = 'Title page', - parent, - status = 'published', -}: Args): Promise { +async function createPage(data: Partial): Promise { return payload.create({ collection: 'pages', - data: { - title, - slug, - _status: status, - parent, - }, + data, }) as unknown as Promise } @@ -65,14 +48,14 @@ describe('Nested Docs Plugin', () => { }) childId = childPage.id - const draftParentPage = await createPage({ slug: 'parent-slug-draft', status: 'draft' }) + const draftParentPage = await createPage({ slug: 'parent-slug-draft', _status: 'draft' }) draftParentId = draftParentPage.id const draftChildPage = await createPage({ slug: 'child-slug-draft', title: 'Child page', parent: draftParentId, - status: 'draft', + _status: 'draft', }) draftChildId = draftChildPage.id }) diff --git a/test/plugin-seo/e2e.spec.ts b/test/plugin-seo/e2e.spec.ts index 3aa1a80344..9eb8dbb431 100644 --- a/test/plugin-seo/e2e.spec.ts +++ b/test/plugin-seo/e2e.spec.ts @@ -52,7 +52,7 @@ describe('SEO Plugin', () => { }, title: 'Test Page', }, - })) as unknown as Promise + })) as unknown as PayloadPage id = createdPage.id }) diff --git a/test/relationships/int.spec.ts b/test/relationships/int.spec.ts index 7e45eac6a7..abb36f4664 100644 --- a/test/relationships/int.spec.ts +++ b/test/relationships/int.spec.ts @@ -64,14 +64,14 @@ describe('Relationships', () => { const nameToQuery = 'name' beforeEach(async () => { - relation = await payload.create({ + relation = await payload.create({ collection: relationSlug, data: { name: nameToQuery, }, }) - filteredRelation = await payload.create({ + filteredRelation = await payload.create({ collection: relationSlug, data: { name: nameToQuery, @@ -79,21 +79,21 @@ describe('Relationships', () => { }, }) - defaultAccessRelation = await payload.create({ + defaultAccessRelation = await payload.create({ collection: defaultAccessRelSlug, data: { name: 'default access', }, }) - chained3 = await payload.create({ + chained3 = await payload.create({ collection: chainedRelSlug, data: { name: 'chain3', }, }) - chained2 = await payload.create({ + chained2 = await payload.create({ collection: chainedRelSlug, data: { name: 'chain2', @@ -101,7 +101,7 @@ describe('Relationships', () => { }, }) - chained = await payload.create({ + chained = await payload.create({ collection: chainedRelSlug, data: { name: 'chain1', @@ -109,7 +109,7 @@ describe('Relationships', () => { }, }) - chained3 = await payload.update({ + chained3 = await payload.update({ id: chained3.id, collection: chainedRelSlug, data: { @@ -119,7 +119,7 @@ describe('Relationships', () => { }) generatedCustomId = `custom-${randomBytes(32).toString('hex').slice(0, 12)}` - customIdRelation = await payload.create({ + customIdRelation = await payload.create({ collection: customIdSlug, data: { id: generatedCustomId, @@ -128,7 +128,7 @@ describe('Relationships', () => { }) generatedCustomIdNumber = Math.floor(Math.random() * 1_000_000) + 1 - customIdNumberRelation = await payload.create({ + customIdNumberRelation = await payload.create({ collection: customIdNumberSlug, data: { id: generatedCustomIdNumber, @@ -431,7 +431,7 @@ describe('Relationships', () => { }, }) - thirdLevelID = thirdLevelDoc.id + thirdLevelID = thirdLevelDoc.id as string const secondLevelDoc = await payload.create({ collection: 'chained', @@ -441,7 +441,7 @@ describe('Relationships', () => { }, }) - secondLevelID = secondLevelDoc.id + secondLevelID = secondLevelDoc.id as string const firstLevelDoc = await payload.create({ collection: 'chained', @@ -451,7 +451,7 @@ describe('Relationships', () => { }, }) - firstLevelID = firstLevelDoc.id + firstLevelID = firstLevelDoc.id as string }) it('should allow querying one level deep', async () => { diff --git a/test/versions/collections/Posts.ts b/test/versions/collections/Posts.ts index f3640079ea..8775507a66 100644 --- a/test/versions/collections/Posts.ts +++ b/test/versions/collections/Posts.ts @@ -5,7 +5,7 @@ import { draftCollectionSlug, postCollectionSlug, versionCollectionSlug, -} from '../slugs' +} from '../slugs.js' const Posts: CollectionConfig = { slug: postCollectionSlug, diff --git a/test/versions/int.spec.ts b/test/versions/int.spec.ts index 08576a348f..b57cd204bd 100644 --- a/test/versions/int.spec.ts +++ b/test/versions/int.spec.ts @@ -70,7 +70,7 @@ describe('Versions', () => { title: 'Here is an autosave post in EN', }, }) - collectionLocalPostID = autosavePost.id + collectionLocalPostID = autosavePost.id as string await payload.update({ id: collectionLocalPostID, @@ -334,7 +334,6 @@ describe('Versions', () => { draft: true, }) - // @ts-expect-error let updatedPost = await payload.update({ id: versionedPost.id, collection: draftCollectionSlug, @@ -350,7 +349,7 @@ describe('Versions', () => { }, draft: true, }) - // @ts-expect-error + updatedPost = await payload.update({ id: versionedPost.id, collection: draftCollectionSlug,