UNPKG

@websolutespa/payload-plugin-bowl

Version:

Bowl PayloadCms plugin of the BOM Repository

41 lines (40 loc) 1.5 kB
import { config, FieldCollection } from '@/test'; import { clearContext, endUsers, getContext, users } from '@websolutespa/test/payload'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { options } from '../../options'; describe('withMedia test', ()=>{ let payload; let client; let userToken; let endUserToken; let apiKey; beforeAll(async ()=>{ const context = await getContext(config); payload = context.payload; client = context.client; userToken = await client.getToken('users', users.admin); endUserToken = await client.getToken('end_users', endUsers.user); apiKey = users.api.apiKey; }); afterAll(async ()=>{ await clearContext(); }); describe('Field config', ()=>{ let collection; let field; beforeAll(async ()=>{ collection = payload.config.collections.find((x)=>x.slug === FieldCollection.slug); }); it('should have a field named "media" of type "upload"', ()=>{ field = collection.fields.find((field)=>field.type === 'upload' && field.name === 'media'); expect(field).toBeDefined(); }); it('should allow relationship with the "media" collection', ()=>{ expect(field.relationTo).toEqual(options.slug.media); }); }); /* @todo: test document creation describe('Document creation', () => {}); */ }); //# sourceMappingURL=withMedia.test.js.map