Skip to content
This repository was archived by the owner on Dec 1, 2025. It is now read-only.

Commit d4d857d

Browse files
committed
chore: fix plugin spec file, adds missing jest package for dev
1 parent 0012083 commit d4d857d

File tree

4 files changed

+394
-365
lines changed

4 files changed

+394
-365
lines changed

dev/plugin.spec.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@ import type { Server } from 'http'
22
import mongoose from 'mongoose'
33
import payload from 'payload'
44
import { start } from './src/server'
5-
import { NewCollectionTypes } from '../src/types'
65

76
describe('Plugin tests', () => {
87
let server: Server
9-
let newCollection: NewCollectionTypes[]
108

119
beforeAll(async () => {
12-
server = await start({ local: true })
10+
await start({ local: true })
1311
})
1412

1513
afterAll(async () => {
@@ -27,8 +25,6 @@ describe('Plugin tests', () => {
2725
sort: 'createdAt',
2826
})
2927

30-
newCollection = newCollectionQuery.docs
31-
3228
expect(newCollectionQuery.totalDocs).toEqual(1)
3329
})
3430
})

dev/src/server.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import express from 'express'
22
import payload from 'payload'
3+
import { InitOptions } from 'payload/config'
34

45
require('dotenv').config()
56
const app = express()
@@ -9,7 +10,7 @@ app.get('/', (_, res) => {
910
res.redirect('/admin')
1011
})
1112

12-
const start = async () => {
13+
export const start = async (args?: Partial<InitOptions>) => {
1314
// Initialize Payload
1415
await payload.init({
1516
secret: process.env.PAYLOAD_SECRET,

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"devDependencies": {
3131
"@payloadcms/eslint-config": "^0.0.1",
3232
"@swc/jest": "^0.2.28",
33+
"@types/jest": "^29.5.11",
3334
"@typescript-eslint/eslint-plugin": "5.12.1",
3435
"@typescript-eslint/parser": "5.12.1",
3536
"dotenv": "^8.2.0",
@@ -38,7 +39,7 @@
3839
"eslint-config-prettier": "^8.5.0",
3940
"eslint-plugin-import": "2.25.4",
4041
"eslint-plugin-prettier": "^4.0.0",
41-
"jest": "^29.6.2",
42+
"jest": "^29.7.0",
4243
"payload": "^2.0.14",
4344
"prettier": "^2.7.1",
4445
"react": "^18.0.0",

0 commit comments

Comments
 (0)