* feat(richtext-lexical): 'bottom' position value for plugins * feat: TestRecorderFeature * chore: restructuring to seed and clear db before each test * chore: make sure all tests pass * chore: make sure indexes are created in seed.ts - this fixes one erroring test * chore: speed up test runs through db snapshots * chore: support drizzle when resetting db * chore: simplify seeding process, by moving boilerplate db reset / snapshot logic into a wrapper function * chore: add new seeding process to admin test suite * chore(deps): upgrade jest and playwright * chore: make sure mongoose-specific tests are not skipped * chore: fix point test, which was depending on another test (that's bad!) * chore: fix incorrect import * chore: remove unnecessary comments * chore: clearly label lexicalE2E test file as todo * chore: simplify seed logic * chore: move versions test suite to new seed system
71 lines
1.7 KiB
TypeScript
71 lines
1.7 KiB
TypeScript
import type { Payload } from '../../packages/payload/src'
|
|
|
|
import { devUser } from '../credentials'
|
|
import { seedDB } from '../helpers/seed'
|
|
import {
|
|
collectionSlugs,
|
|
customViews1CollectionSlug,
|
|
customViews2CollectionSlug,
|
|
geoCollectionSlug,
|
|
noApiViewCollectionSlug,
|
|
postsCollectionSlug,
|
|
usersCollectionSlug,
|
|
} from './slugs'
|
|
|
|
export async function clearAndSeedEverything(_payload: Payload) {
|
|
return await seedDB({
|
|
snapshotKey: 'adminTest',
|
|
shouldResetDB: true,
|
|
collectionSlugs,
|
|
_payload,
|
|
seedFunction: async (_payload) => {
|
|
await Promise.all([
|
|
_payload.create({
|
|
collection: usersCollectionSlug,
|
|
data: {
|
|
email: devUser.email,
|
|
password: devUser.password,
|
|
},
|
|
}),
|
|
...[...Array(11)].map(() => {
|
|
_payload.create({
|
|
collection: postsCollectionSlug,
|
|
data: {
|
|
title: 'Title',
|
|
description: 'Description',
|
|
},
|
|
})
|
|
}),
|
|
_payload.create({
|
|
collection: customViews1CollectionSlug,
|
|
data: {
|
|
title: 'Custom View',
|
|
},
|
|
}),
|
|
_payload.create({
|
|
collection: customViews2CollectionSlug,
|
|
data: {
|
|
title: 'Custom View',
|
|
},
|
|
}),
|
|
_payload.create({
|
|
collection: geoCollectionSlug,
|
|
data: {
|
|
point: [7, -7],
|
|
},
|
|
}),
|
|
_payload.create({
|
|
collection: geoCollectionSlug,
|
|
data: {
|
|
point: [5, -5],
|
|
},
|
|
}),
|
|
_payload.create({
|
|
collection: noApiViewCollectionSlug,
|
|
data: {},
|
|
}),
|
|
])
|
|
},
|
|
})
|
|
}
|