chore: lexical int tests: do not use relationTo to collection with rich text relationships disabled

This commit is contained in:
Alessio Gravili
2024-05-01 00:47:40 -04:00
parent 8829fba6cf
commit 401c16e485
4 changed files with 6 additions and 5 deletions

View File

@@ -56,7 +56,7 @@ export const uploadValidation = (
} }
if (errorPaths.length) { if (errorPaths.length) {
return 'Block validation failed: ' + errorPaths.join(', ') return 'Upload fields validation failed: ' + errorPaths.join(', ')
} }
return true return true

View File

@@ -33,6 +33,7 @@ export function textToLexicalJSON({
direction: 'ltr', direction: 'ltr',
format: '', format: '',
indent: 0, indent: 0,
textFormat: 0,
type: 'paragraph', type: 'paragraph',
version: 1, version: 1,
} as SerializedParagraphNode, } as SerializedParagraphNode,

View File

@@ -1,3 +1,4 @@
import { textFieldsSlug } from '../../slugs.js'
import { loremIpsum } from './loremIpsum.js' import { loremIpsum } from './loremIpsum.js'
export function generateLexicalRichText() { export function generateLexicalRichText() {
@@ -90,8 +91,8 @@ export function generateLexicalRichText() {
fields: { fields: {
url: 'https://', url: 'https://',
doc: { doc: {
value: '{{ARRAY_DOC_ID}}', value: '{{TEXT_DOC_ID}}',
relationTo: 'array-fields', relationTo: textFieldsSlug,
}, },
newTab: false, newTab: false,
linkType: 'internal', linkType: 'internal',

View File

@@ -13,7 +13,6 @@ import type { LexicalField, LexicalMigrateField, RichTextField } from './payload
import { devUser } from '../credentials.js' import { devUser } from '../credentials.js'
import { NextRESTClient } from '../helpers/NextRESTClient.js' import { NextRESTClient } from '../helpers/NextRESTClient.js'
import { initPayloadInt } from '../helpers/initPayloadInt.js' import { initPayloadInt } from '../helpers/initPayloadInt.js'
import { arrayDoc } from './collections/Array/shared.js'
import { lexicalDocData } from './collections/Lexical/data.js' import { lexicalDocData } from './collections/Lexical/data.js'
import { lexicalMigrateDocData } from './collections/LexicalMigrate/data.js' import { lexicalMigrateDocData } from './collections/LexicalMigrate/data.js'
import { richTextDocData } from './collections/RichText/data.js' import { richTextDocData } from './collections/RichText/data.js'
@@ -172,7 +171,7 @@ describe('Lexical', () => {
const linkNode: SerializedLinkNode = (lexical.root.children[1] as SerializedParagraphNode) const linkNode: SerializedLinkNode = (lexical.root.children[1] as SerializedParagraphNode)
.children[3] as SerializedLinkNode .children[3] as SerializedLinkNode
expect(linkNode.fields.doc.value.items[1].text).toStrictEqual(arrayDoc.items[1].text) expect(linkNode.fields.doc.value.text).toStrictEqual(textDoc.text)
}) })
it('should populate relationship node', async () => { it('should populate relationship node', async () => {