@@ -29,7 +29,6 @@ describe('Advanced GraphQL Features Tests', () => {
2929 } )
3030
3131 beforeEach ( async ( ) => {
32- // Clean up in correct order due to foreign key constraints
3332 await prismaClient . productTag . deleteMany ( )
3433 await prismaClient . review . deleteMany ( )
3534 await prismaClient . product . deleteMany ( )
@@ -66,43 +65,35 @@ describe('Advanced GraphQL Features Tests', () => {
6665 const types = result . data . __schema . types
6766 const typeNames = types . map ( ( t : any ) => t . name )
6867
69- // Main object types
7068 expect ( typeNames ) . toContain ( 'Product' )
7169 expect ( typeNames ) . toContain ( 'Review' )
7270 expect ( typeNames ) . toContain ( 'Tag' )
7371 expect ( typeNames ) . toContain ( 'ProductTag' )
7472
75- // Connection types
7673 expect ( typeNames ) . toContain ( 'ProductConnection' )
7774 expect ( typeNames ) . toContain ( 'ReviewConnection' )
7875 expect ( typeNames ) . toContain ( 'TagConnection' )
7976
80- // Edge types
8177 expect ( typeNames ) . toContain ( 'ProductEdge' )
8278 expect ( typeNames ) . toContain ( 'ReviewEdge' )
8379 expect ( typeNames ) . toContain ( 'TagEdge' )
8480
85- // Filter types
8681 expect ( typeNames ) . toContain ( 'ProductFilterInput' )
8782 expect ( typeNames ) . toContain ( 'ReviewFilterInput' )
8883 expect ( typeNames ) . toContain ( 'TagFilterInput' )
8984
90- // Sort types
9185 expect ( typeNames ) . toContain ( 'ProductSortInput' )
9286 expect ( typeNames ) . toContain ( 'ReviewSortInput' )
9387 expect ( typeNames ) . toContain ( 'TagSortInput' )
9488
95- // Enums
9689 expect ( typeNames ) . toContain ( 'ProductStatus' )
9790 expect ( typeNames ) . toContain ( 'ReviewRating' )
9891 expect ( typeNames ) . toContain ( 'SortDirection' )
9992
100- // Common filter types
10193 expect ( typeNames ) . toContain ( 'NumericFilterInput' )
10294 expect ( typeNames ) . toContain ( 'StringFilterInput' )
10395 expect ( typeNames ) . toContain ( 'BooleanFilterInput' )
10496
105- // Pagination types
10697 expect ( typeNames ) . toContain ( 'PageInfo' )
10798 } )
10899 } )
@@ -149,7 +140,6 @@ describe('Advanced GraphQL Features Tests', () => {
149140
150141 describe ( 'Relay Connections and Pagination' , ( ) => {
151142 test ( 'Products connection follows Relay specification' , async ( ) => {
152- // Create test products
153143 const products = await Promise . all ( [
154144 prismaClient . product . create ( {
155145 data : { name : 'Product A' , price : 10.0 , status : 'PUBLISHED' } ,
@@ -196,14 +186,12 @@ describe('Advanced GraphQL Features Tests', () => {
196186
197187 const connection = result . data . products
198188
199- // Verify Relay structure
200189 expect ( connection . edges ) . toHaveLength ( 2 )
201190 expect ( connection . totalCount ) . toBe ( 3 )
202191 expect ( connection . pageInfo . hasNextPage ) . toBe ( true )
203192 expect ( connection . pageInfo . startCursor ) . toBeDefined ( )
204193 expect ( connection . pageInfo . endCursor ) . toBeDefined ( )
205194
206- // Verify edges structure
207195 connection . edges . forEach ( ( edge : any ) => {
208196 expect ( edge . node ) . toBeDefined ( )
209197 expect ( edge . cursor ) . toBeDefined ( )
@@ -212,14 +200,12 @@ describe('Advanced GraphQL Features Tests', () => {
212200 } )
213201
214202 test ( 'Forward pagination with cursors works correctly' , async ( ) => {
215- // Create test products
216203 await Promise . all ( [
217204 prismaClient . product . create ( { data : { name : 'Product 1' , price : 10.0 , status : 'PUBLISHED' } } ) ,
218205 prismaClient . product . create ( { data : { name : 'Product 2' , price : 20.0 , status : 'PUBLISHED' } } ) ,
219206 prismaClient . product . create ( { data : { name : 'Product 3' , price : 30.0 , status : 'PUBLISHED' } } ) ,
220207 ] )
221208
222- // Get first page
223209 const firstPageResponse = await fetch ( GRAPHQL_ENDPOINT , {
224210 method : 'POST' ,
225211 headers : { 'Content-Type' : 'application/json' } ,
@@ -247,7 +233,6 @@ describe('Advanced GraphQL Features Tests', () => {
247233
248234 const endCursor = firstPage . data . products . pageInfo . endCursor
249235
250- // Get second page using cursor
251236 const secondPageResponse = await fetch ( GRAPHQL_ENDPOINT , {
252237 method : 'POST' ,
253238 headers : { 'Content-Type' : 'application/json' } ,
@@ -356,7 +341,7 @@ describe('Advanced GraphQL Features Tests', () => {
356341
357342 const result = await response . json ( )
358343 expect ( result . errors ) . toBeUndefined ( )
359- expect ( result . data . products . totalCount ) . toBe ( 2 ) // Product B (price >= 150) and Product C (published AND price <= 60)
344+ expect ( result . data . products . totalCount ) . toBe ( 2 )
360345 } )
361346 } )
362347
@@ -486,7 +471,6 @@ describe('Advanced GraphQL Features Tests', () => {
486471 data : { name : 'test-tag' , color : '#FF0000' } ,
487472 } )
488473
489- // Assign tag to product
490474 const assignResponse = await fetch ( GRAPHQL_ENDPOINT , {
491475 method : 'POST' ,
492476 headers : { 'Content-Type' : 'application/json' } ,
@@ -504,7 +488,6 @@ describe('Advanced GraphQL Features Tests', () => {
504488 expect ( assignResult . errors ) . toBeUndefined ( )
505489 expect ( assignResult . data . assignTagToProduct ) . toBe ( true )
506490
507- // Verify relation exists
508491 const queryResponse = await fetch ( GRAPHQL_ENDPOINT , {
509492 method : 'POST' ,
510493 headers : { 'Content-Type' : 'application/json' } ,
0 commit comments