chore: fix e2e tests by not importing from ./config
This commit is contained in:
@@ -3,20 +3,19 @@ import type { FieldAccess } from '../../packages/payload/src/fields/config/types
|
||||
import { buildConfigWithDefaults } from '../buildConfigWithDefaults'
|
||||
import { devUser } from '../credentials'
|
||||
import { firstArrayText, secondArrayText } from './shared'
|
||||
|
||||
export const slug = 'posts'
|
||||
export const unrestrictedSlug = 'unrestricted'
|
||||
export const readOnlySlug = 'read-only-collection'
|
||||
|
||||
export const userRestrictedSlug = 'user-restricted'
|
||||
export const restrictedSlug = 'restricted'
|
||||
export const restrictedVersionsSlug = 'restricted-versions'
|
||||
export const siblingDataSlug = 'sibling-data'
|
||||
export const relyOnRequestHeadersSlug = 'rely-on-request-headers'
|
||||
export const docLevelAccessSlug = 'doc-level-access'
|
||||
export const hiddenFieldsSlug = 'hidden-fields'
|
||||
|
||||
export const hiddenAccessSlug = 'hidden-access'
|
||||
import {
|
||||
docLevelAccessSlug,
|
||||
hiddenAccessSlug,
|
||||
hiddenFieldsSlug,
|
||||
readOnlySlug,
|
||||
relyOnRequestHeadersSlug,
|
||||
restrictedSlug,
|
||||
restrictedVersionsSlug,
|
||||
siblingDataSlug,
|
||||
slug,
|
||||
unrestrictedSlug,
|
||||
userRestrictedSlug,
|
||||
} from './shared'
|
||||
|
||||
const openAccess = {
|
||||
create: () => true,
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
restrictedVersionsSlug,
|
||||
slug,
|
||||
unrestrictedSlug,
|
||||
} from './config'
|
||||
} from './shared'
|
||||
|
||||
/**
|
||||
* TODO: Access Control
|
||||
|
||||
@@ -1,2 +1,16 @@
|
||||
export const firstArrayText = 'first-array-text'
|
||||
export const secondArrayText = 'second-array-text'
|
||||
|
||||
export const slug = 'posts'
|
||||
export const unrestrictedSlug = 'unrestricted'
|
||||
export const readOnlySlug = 'read-only-collection'
|
||||
|
||||
export const userRestrictedSlug = 'user-restricted'
|
||||
export const restrictedSlug = 'restricted'
|
||||
export const restrictedVersionsSlug = 'restricted-versions'
|
||||
export const siblingDataSlug = 'sibling-data'
|
||||
export const relyOnRequestHeadersSlug = 'rely-on-request-headers'
|
||||
export const docLevelAccessSlug = 'doc-level-access'
|
||||
export const hiddenFieldsSlug = 'hidden-fields'
|
||||
|
||||
export const hiddenAccessSlug = 'hidden-access'
|
||||
|
||||
@@ -4,12 +4,7 @@ import { mapAsync } from '../../packages/payload/src/utilities/mapAsync'
|
||||
import { buildConfigWithDefaults } from '../buildConfigWithDefaults'
|
||||
import { devUser } from '../credentials'
|
||||
import { AuthDebug } from './AuthDebug'
|
||||
|
||||
export const slug = 'users'
|
||||
|
||||
export const namedSaveToJWTValue = 'namedSaveToJWT value'
|
||||
|
||||
export const saveToJWTKey = 'x-custom-jwt-property-name'
|
||||
import { namedSaveToJWTValue, saveToJWTKey, slug } from './shared'
|
||||
|
||||
export default buildConfigWithDefaults({
|
||||
admin: {
|
||||
|
||||
@@ -5,7 +5,7 @@ import { expect, test } from '@playwright/test'
|
||||
import { login, saveDocAndAssert } from '../helpers'
|
||||
import { AdminUrlUtil } from '../helpers/adminUrlUtil'
|
||||
import { initPayloadE2E } from '../helpers/configHelpers'
|
||||
import { slug } from './config'
|
||||
import { slug } from './shared'
|
||||
|
||||
/**
|
||||
* TODO: Auth
|
||||
|
||||
5
test/auth/shared.ts
Normal file
5
test/auth/shared.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export const slug = 'users'
|
||||
|
||||
export const namedSaveToJWTValue = 'namedSaveToJWT value'
|
||||
|
||||
export const saveToJWTKey = 'x-custom-jwt-property-name'
|
||||
@@ -6,12 +6,16 @@ import { ArrayCollection } from './collections/Array'
|
||||
import {
|
||||
defaultLocale,
|
||||
englishTitle,
|
||||
localizedPostsSlug,
|
||||
relationEnglishTitle,
|
||||
relationEnglishTitle2,
|
||||
relationSpanishTitle,
|
||||
relationSpanishTitle2,
|
||||
relationshipLocalizedSlug,
|
||||
spanishLocale,
|
||||
spanishTitle,
|
||||
withLocalizedRelSlug,
|
||||
withRequiredLocalizedFields,
|
||||
} from './shared'
|
||||
|
||||
export type LocalizedPostAllLocale = LocalizedPost & {
|
||||
@@ -21,11 +25,6 @@ export type LocalizedPostAllLocale = LocalizedPost & {
|
||||
}
|
||||
}
|
||||
|
||||
export const localizedPostsSlug = 'localized-posts'
|
||||
export const withLocalizedRelSlug = 'with-localized-relationship'
|
||||
export const relationshipLocalizedSlug = 'relationship-localized'
|
||||
export const withRequiredLocalizedFields = 'localized-required'
|
||||
|
||||
const openAccess = {
|
||||
read: () => true,
|
||||
create: () => true,
|
||||
|
||||
@@ -8,8 +8,7 @@ import payload from '../../packages/payload/src'
|
||||
import { saveDocAndAssert } from '../helpers'
|
||||
import { AdminUrlUtil } from '../helpers/adminUrlUtil'
|
||||
import { initPayloadTest } from '../helpers/configHelpers'
|
||||
import { localizedPostsSlug } from './config'
|
||||
import { englishTitle, spanishLocale } from './shared'
|
||||
import { englishTitle, localizedPostsSlug, spanishLocale } from './shared'
|
||||
|
||||
/**
|
||||
* TODO: Localization
|
||||
|
||||
@@ -7,3 +7,9 @@ export const relationSpanishTitle2 = `${relationSpanishTitle}2`
|
||||
|
||||
export const defaultLocale = 'en'
|
||||
export const spanishLocale = 'es'
|
||||
|
||||
// Slugs
|
||||
export const localizedPostsSlug = 'localized-posts'
|
||||
export const withLocalizedRelSlug = 'with-localized-relationship'
|
||||
export const relationshipLocalizedSlug = 'relationship-localized'
|
||||
export const withRequiredLocalizedFields = 'localized-required'
|
||||
|
||||
@@ -7,18 +7,7 @@ import removeFiles from '../helpers/removeFiles'
|
||||
import { Uploads1 } from './collections/Upload1'
|
||||
import Uploads2 from './collections/Upload2'
|
||||
import AdminThumbnailCol from './collections/admin-thumbnail'
|
||||
|
||||
export const mediaSlug = 'media'
|
||||
|
||||
export const relationSlug = 'relation'
|
||||
|
||||
export const audioSlug = 'audio'
|
||||
|
||||
export const enlargeSlug = 'enlarge'
|
||||
|
||||
export const reduceSlug = 'reduce'
|
||||
|
||||
export const adminThumbnailSlug = 'admin-thumbnail'
|
||||
import { audioSlug, enlargeSlug, mediaSlug, reduceSlug, relationSlug } from './shared'
|
||||
|
||||
const mockModulePath = path.resolve(__dirname, './mocks/mockFSModule.js')
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import { saveDocAndAssert } from '../helpers'
|
||||
import { AdminUrlUtil } from '../helpers/adminUrlUtil'
|
||||
import { initPayloadE2E } from '../helpers/configHelpers'
|
||||
import { adminThumbnailSrc } from './collections/admin-thumbnail'
|
||||
import { adminThumbnailSlug, audioSlug, mediaSlug, relationSlug } from './config'
|
||||
import { adminThumbnailSlug, audioSlug, mediaSlug, relationSlug } from './shared'
|
||||
|
||||
const { beforeAll, describe } = test
|
||||
|
||||
|
||||
11
test/uploads/shared.ts
Normal file
11
test/uploads/shared.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
export const mediaSlug = 'media'
|
||||
|
||||
export const relationSlug = 'relation'
|
||||
|
||||
export const audioSlug = 'audio'
|
||||
|
||||
export const enlargeSlug = 'enlarge'
|
||||
|
||||
export const reduceSlug = 'reduce'
|
||||
|
||||
export const adminThumbnailSlug = 'admin-thumbnail'
|
||||
Reference in New Issue
Block a user