File tree Expand file tree Collapse file tree 2 files changed +30
-27
lines changed
packages/core-graph/src/private/schemas Expand file tree Collapse file tree 2 files changed +30
-27
lines changed Original file line number Diff line number Diff line change @@ -141,7 +141,7 @@ const SlantNodeWithFixSchema = pipe(
141141 * - `@value` could be null, if unwrapped, will be confusing as we removed nulls
142142 * - Do not handle full JSON-LD spec: `@context` is an opaque string and its schema is not honored
143143 * - Node reference only has `@id` and it should not contain `@type`
144- * - Reduce confusion: node reference must not appear at the root of the flattened graph
144+ * - Reduce confusion: node reference must not appear at the root of the flattened graph, they are semantically empty
145145 * - Auto-linking for Schema.org: `hasPart` and `isPartOf` are auto-inversed
146146 * - Keep its root: every node is compliant to JSON-LD, understood by standard parsers
147147 * - Debuggability: must have at least one `@type`
Original file line number Diff line number Diff line change @@ -196,30 +196,33 @@ scenario('flattenNodeObject()', bdd => {
196196 } ) ;
197197} ) ;
198198
199- scenario ( 'Reduce confusion: node reference must not appear at the root of the flattened graph' , bdd => {
200- bdd
201- . given (
202- 'a node with @id and @type only' ,
203- ( ) =>
204- ( {
205- '@id' : '_:c1' ,
206- '@type' : 'Conversation'
207- } ) as const
208- )
209- . when ( 'colored' , node => {
210- try {
211- flattenNodeObject ( node ) ;
212- } catch ( error ) {
213- return error ;
214- }
215-
216- return undefined ;
217- } )
218- . then ( 'should throw' , ( _ , error ) => {
219- expect ( ( ) => {
220- if ( error ) {
221- throw error ;
199+ scenario (
200+ 'Reduce confusion: node reference must not appear at the root of the flattened graph, they are semantically empty' ,
201+ bdd => {
202+ bdd
203+ . given (
204+ 'a node with @id and @type only' ,
205+ ( ) =>
206+ ( {
207+ '@id' : '_:c1' ,
208+ '@type' : 'Conversation'
209+ } ) as const
210+ )
211+ . when ( 'colored' , node => {
212+ try {
213+ flattenNodeObject ( node ) ;
214+ } catch ( error ) {
215+ return error ;
222216 }
223- } ) . toThrow ( 'Node reference cannot be flattened' ) ;
224- } ) ;
225- } ) ;
217+
218+ return undefined ;
219+ } )
220+ . then ( 'should throw' , ( _ , error ) => {
221+ expect ( ( ) => {
222+ if ( error ) {
223+ throw error ;
224+ }
225+ } ) . toThrow ( 'Node reference cannot be flattened' ) ;
226+ } ) ;
227+ }
228+ ) ;
You can’t perform that action at this time.
0 commit comments