@@ -5,7 +5,7 @@ import { expect } from 'vitest'
55import { importDefaults } from '#package/testing/import-defaults.js'
66import { test } from 'vitest'
77
8- test ( 'expand directive @create ' , async ( ) => {
8+ test ( 'expand directive @item ' , async ( ) => {
99 const schema = await importDefaults ( {
1010 base : ( ) => import ( '#package/fixtures/base.gql?raw' ) ,
1111 initial : ( ) => import ( './fixtures/initial.gql?raw' ) ,
@@ -19,3 +19,33 @@ test('expand directive @create', async () => {
1919
2020 expect ( result ) . toBe ( schema . expanded )
2121} )
22+
23+ test ( '@item error case 1' , async ( ) => {
24+ const schema = await importDefaults ( {
25+ initial : ( ) => import ( './fixtures/errors/x1.gql?raw' ) ,
26+ } )
27+
28+ expect ( ( ) => buildSchema ( schema . initial ) ) . not . toThrow ( )
29+
30+ // oxlint-disable-next-line eslint-plugin-jest(no-conditional-expect)
31+ await expect (
32+ execExpansion ( { expand, schema : schema . initial } ) ,
33+ ) . rejects . toThrow (
34+ 'Type with directive "@item" should have exactly one field of type ID.' ,
35+ )
36+ } )
37+
38+ test ( '@item error case 2' , async ( ) => {
39+ const schema = await importDefaults ( {
40+ initial : ( ) => import ( './fixtures/errors/x2.gql?raw' ) ,
41+ } )
42+
43+ expect ( ( ) => buildSchema ( schema . initial ) ) . not . toThrow ( )
44+
45+ // oxlint-disable-next-line eslint-plugin-jest(no-conditional-expect)
46+ await expect (
47+ execExpansion ( { expand, schema : schema . initial } ) ,
48+ ) . rejects . toThrow (
49+ 'Type with directive "@item" should have exactly one field of type ID.' ,
50+ )
51+ } )
0 commit comments