Skip to content

Commit

Permalink
chore: add test/ to workspace, update most references
Browse files Browse the repository at this point in the history
  • Loading branch information
denolfe committed Mar 19, 2024
1 parent 1e10f02 commit c5ecf48
Show file tree
Hide file tree
Showing 242 changed files with 634 additions and 474 deletions.
69 changes: 69 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
packages:
# all packages in direct subdirs of packages/
- 'packages/*'
- 'test/REST_API'
- 'test'
# exclude packages that are inside test directories
# - '!**/test/**'
4 changes: 3 additions & 1 deletion test/_community/collections/Media/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import type { CollectionConfig } from '../../../../packages/payload/src/collections/config/types.js'
import type { CollectionConfig } from 'payload/types'

import { getPayload } from 'payload'

export const mediaSlug = 'media'

Expand Down
2 changes: 1 addition & 1 deletion test/_community/collections/Posts/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { CollectionConfig } from '../../../../packages/payload/src/collections/config/types.js'
import type { CollectionConfig } from 'payload/types'

import { mediaSlug } from '../Media/index.js'

Expand Down
2 changes: 1 addition & 1 deletion test/_community/globals/Menu/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { GlobalConfig } from '../../../../packages/payload/src/globals/config/types.js'
import type { GlobalConfig } from 'payload/types'

export const menuSlug = 'menu'

Expand Down
3 changes: 2 additions & 1 deletion test/_community/int.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Payload } from '../../packages/payload/types.js'
import type { Payload } from 'payload'

import type { NextRESTClient } from '../helpers/NextRESTClient.js'

import { devUser } from '../credentials.js'
Expand Down
2 changes: 1 addition & 1 deletion test/access-control/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { FieldAccess } from '../../packages/payload/src/fields/config/types.js'
import type { FieldAccess } from 'payload/types'

import { buildConfigWithDefaults } from '../buildConfigWithDefaults.js'
import { devUser } from '../credentials.js'
Expand Down
2 changes: 1 addition & 1 deletion test/access-control/e2e.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { Page } from '@playwright/test'
import type { Payload } from 'payload/types'

import { expect, test } from '@playwright/test'
import path from 'path'
import { fileURLToPath } from 'url'

import type { Payload } from '../../packages/payload/src/types/index.js'
import type { ReadOnlyCollection, RestrictedVersion } from './payload-types.js'

import wait from '../../packages/payload/src/utilities/wait.js'
Expand Down
6 changes: 4 additions & 2 deletions test/access-control/int.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import type { Payload, PayloadRequest } from '../../packages/payload/src/types/index.js'
import type { Payload, PayloadRequest } from 'payload/types'

import { Forbidden } from 'payload/errors'

import type { Post, RelyOnRequestHeader, Restricted } from './payload-types.js'

import { Forbidden } from '../../packages/payload/src/errors/index.js'
import { initPayloadInt } from '../helpers/initPayloadInt.js'
import configPromise, { requestHeaders } from './config.js'
import {
Expand Down
2 changes: 1 addition & 1 deletion test/admin/collections/CustomIdRow.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { CollectionConfig } from '../../../packages/payload/src/collections/config/types.js'
import type { CollectionConfig } from 'payload/types'

export const CustomIdRow: CollectionConfig = {
slug: 'customIdRow',
Expand Down
2 changes: 1 addition & 1 deletion test/admin/collections/CustomIdTab.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { CollectionConfig } from '../../../packages/payload/src/collections/config/types.js'
import type { CollectionConfig } from 'payload/types'

export const CustomIdTab: CollectionConfig = {
slug: 'customIdTab',
Expand Down
2 changes: 1 addition & 1 deletion test/admin/collections/CustomViews1.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { CollectionConfig } from '../../../packages/payload/src/collections/config/types.js'
import type { CollectionConfig } from 'payload/types'

import { CustomEditView } from '../components/views/CustomEdit/index.js'
import { customViews1CollectionSlug } from '../slugs.js'
Expand Down
2 changes: 1 addition & 1 deletion test/admin/collections/CustomViews2.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { CollectionConfig } from '../../../packages/payload/src/collections/config/types.js'
import type { CollectionConfig } from 'payload/types'

import { CustomTabComponent } from '../components/CustomTabComponent/index.js'
import { CustomTabView } from '../components/views/CustomTab/index.js'
Expand Down
2 changes: 1 addition & 1 deletion test/admin/collections/Geo.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { CollectionConfig } from '../../../packages/payload/src/collections/config/types.js'
import type { CollectionConfig } from 'payload/types'

import { CollectionAPIButton } from '../components/CollectionAPIButton/index.js'
import { CollectionEditButton } from '../components/CollectionEditButton/index.js'
Expand Down
2 changes: 1 addition & 1 deletion test/admin/collections/Group1A.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { CollectionConfig } from '../../../packages/payload/src/collections/config/types.js'
import type { CollectionConfig } from 'payload/types'

import { group1Collection1Slug } from '../slugs.js'

Expand Down
2 changes: 1 addition & 1 deletion test/admin/collections/Group1B.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { CollectionConfig } from '../../../packages/payload/src/collections/config/types.js'
import type { CollectionConfig } from 'payload/types'

import { group1Collection2Slug } from '../slugs.js'

Expand Down
2 changes: 1 addition & 1 deletion test/admin/collections/Group2A.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { CollectionConfig } from '../../../packages/payload/src/collections/config/types.js'
import type { CollectionConfig } from 'payload/types'

import { group2Collection1Slug } from '../slugs.js'

Expand Down
2 changes: 1 addition & 1 deletion test/admin/collections/Group2B.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { CollectionConfig } from '../../../packages/payload/src/collections/config/types.js'
import type { CollectionConfig } from 'payload/types'

import { group2Collection2Slug } from '../slugs.js'

Expand Down
2 changes: 1 addition & 1 deletion test/admin/collections/Hidden.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { CollectionConfig } from '../../../packages/payload/src/collections/config/types.js'
import type { CollectionConfig } from 'payload/types'

import { hiddenCollectionSlug } from '../slugs.js'

Expand Down
2 changes: 1 addition & 1 deletion test/admin/collections/NoApiView.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { CollectionConfig } from '../../../packages/payload/src/collections/config/types.js'
import type { CollectionConfig } from 'payload/types'

import { noApiViewCollectionSlug } from '../slugs.js'

Expand Down
43 changes: 22 additions & 21 deletions test/admin/collections/Posts.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { CollectionConfig } from '../../../packages/payload/src/collections/config/types.js'
import { slateEditor } from '@payloadcms/richtext-slate'

import type { CollectionConfig } from 'payload/types'

import { slateEditor } from '../../../packages/richtext-slate/src/index.js'
import { DemoUIFieldCell } from '../components/DemoUIField/Cell.js'
import { DemoUIField } from '../components/DemoUIField/Field.js'
import {
Expand All @@ -12,27 +13,19 @@ import { postsCollectionSlug } from '../slugs.js'

export const Posts: CollectionConfig = {
slug: postsCollectionSlug,
labels: {
singular: slugSingularLabel,
plural: slugPluralLabel,
},
admin: {
defaultColumns: ['id', 'number', 'title', 'description', 'demoUIField'],
description: 'Description',
listSearchableFields: ['id', 'title', 'description', 'number'],
group: 'One',
useAsTitle: 'title',
defaultColumns: ['id', 'number', 'title', 'description', 'demoUIField'],
listSearchableFields: ['id', 'title', 'description', 'number'],
preview: () => 'https://payloadcms.com',
},
versions: {
drafts: true,
useAsTitle: 'title',
},
fields: [
{
type: 'tabs',
tabs: [
{
label: 'Tab 1',
fields: [
{
name: 'title',
Expand All @@ -56,17 +49,18 @@ export const Posts: CollectionConfig = {
}),
},
{
type: 'ui',
name: 'demoUIField',
label: 'Demo UI Field',
type: 'ui',
admin: {
components: {
Field: DemoUIField,
Cell: DemoUIFieldCell,
Field: DemoUIField,
},
},
label: 'Demo UI Field',
},
],
label: 'Tab 1',
},
],
},
Expand All @@ -83,21 +77,21 @@ export const Posts: CollectionConfig = {
{
name: 'relationship',
type: 'relationship',
relationTo: 'posts',
admin: {
position: 'sidebar',
},
relationTo: 'posts',
},
{
name: 'sidebarField',
type: 'text',
access: {
update: () => false,
},
admin: {
position: 'sidebar',
description:
'This is a very long description that takes many characters to complete and hopefully will wrap instead of push the sidebar open, lorem ipsum dolor sit amet consectetur adipisicing elit. Quisquam, voluptatum voluptates. Quisquam, voluptatum voluptates.',
},
access: {
update: () => false,
position: 'sidebar',
},
},
{
Expand All @@ -122,4 +116,11 @@ export const Posts: CollectionConfig = {
},
},
],
labels: {
plural: slugPluralLabel,
singular: slugSingularLabel,
},
versions: {
drafts: true,
},
}
2 changes: 1 addition & 1 deletion test/admin/collections/Users.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { CollectionConfig } from '../../../packages/payload/src/collections/config/types.js'
import type { CollectionConfig } from 'payload/types'

import { usersCollectionSlug } from '../slugs.js'

Expand Down
4 changes: 3 additions & 1 deletion test/admin/components/AfterNavLinks/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
'use client'

import { useConfig } from '@payloadcms/ui'
import LinkImport from 'next/link.js'
const Link = (LinkImport.default || LinkImport) as unknown as typeof LinkImport.default

import React from 'react'

// As this is the demo project, we import our dependencies from the `src` directory.
import { useConfig } from '../../../../packages/ui/src/providers/Config/index.js'
// import { useConfig } from '@payloadcms/ui'
// import { useConfig } from '@payloadcms/ui'

// In your projects, you can import as follows:
// import { useConfig } from 'payload/components/utilities';
Expand Down
2 changes: 1 addition & 1 deletion test/admin/components/BeforeLogin/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import React from 'react'

import { useTranslation } from '../../../../packages/ui/src/providers/Translation/index.js'
import { useTranslation } from '@payloadcms/ui'

export const BeforeLogin: React.FC = () => {
const translation = useTranslation()
Expand Down
4 changes: 2 additions & 2 deletions test/admin/components/CustomTabComponent/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use client'

import type { DocumentTabComponent } from 'payload/types'

import React from 'react'
import { Link, useRouteMatch } from 'react-router-dom'

import type { DocumentTabComponent } from '../../../../packages/payload/src/admin/types.js'

import './index.scss'

export const CustomTabComponent: DocumentTabComponent = (props) => {
Expand Down
7 changes: 2 additions & 5 deletions test/admin/components/FieldDescription/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import React from 'react'
import type { DescriptionComponent, DescriptionFunction } from 'payload/types'

import type {
DescriptionComponent,
DescriptionFunction,
} from '../../../../packages/payload/src/admin/types.js'
import React from 'react'

export const FieldDescriptionComponent: DescriptionComponent<string> = ({ path, value }) => {
return (
Expand Down
4 changes: 2 additions & 2 deletions test/admin/components/Logout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import React from 'react'

import { LogOut } from '../../../../packages/ui/src/icons/LogOut/index.js'
import { useConfig } from '../../../../packages/ui/src/providers/Config/index.js'
import { LogOut } from '@payloadcms/ui'
import { useConfig } from '@payloadcms/ui'

export const Logout: React.FC = () => {
const config = useConfig()
Expand Down
4 changes: 2 additions & 2 deletions test/admin/components/views/CustomAccount/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { Fragment } from 'react'
import type { AdminViewComponent } from 'payload/types'

import type { AdminViewComponent } from '../../../../../packages/payload/src/admin/types.js'
import React, { Fragment } from 'react'

export const CustomAccountView: AdminViewComponent = () => {
return (
Expand Down
4 changes: 2 additions & 2 deletions test/admin/components/views/CustomDashboard/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { Fragment } from 'react'
import type { AdminViewComponent } from 'payload/types'

import type { AdminViewComponent } from '../../../../../packages/payload/src/admin/types.js'
import React, { Fragment } from 'react'

export const CustomDashboardView: AdminViewComponent = () => {
return (
Expand Down
Loading

0 comments on commit c5ecf48

Please sign in to comment.