feat: async plugins (#2030)

* feat: async plugins

* wip: async config

* fix: async config
This commit is contained in:
Jacob Fletcher
2023-02-13 10:46:55 -05:00
committed by GitHub
parent 11532857d2
commit 9f30553813
25 changed files with 218 additions and 119 deletions

View File

@@ -1,13 +1,14 @@
import mongoose from 'mongoose';
import { initPayloadTest } from '../helpers/configHelpers';
import payload from '../../src';
import config from './config';
import type { Array as ArrayCollection } from './payload-types';
import configPromise from './config';
const collection = config.collections[0]?.slug;
let collection: string;
describe('array-update', () => {
beforeAll(async () => {
const config = await configPromise;
collection = config.collections[0]?.slug;
await initPayloadTest({ __dirname });
});
@@ -45,7 +46,7 @@ describe('array-update', () => {
required: updatedText,
};
const updatedDoc = await payload.update<ArrayCollection>({
const updatedDoc = await payload.update({
id: doc.id,
collection,
data: {
@@ -67,7 +68,7 @@ describe('array-update', () => {
optional: 'optional test',
};
const doc = await payload.create<ArrayCollection>({
const doc = await payload.create({
collection,
data: {
array: [
@@ -80,7 +81,7 @@ describe('array-update', () => {
},
});
const updatedDoc = await payload.update<ArrayCollection>({
const updatedDoc = await payload.update({
id: doc.id,
collection,
data: {