@@ -8,6 +8,7 @@ import org.junit.jupiter.api.Assertions.assertTrue
88import org.junit.jupiter.api.Assumptions.assumeTrue
99import org.junit.jupiter.api.Test
1010import viaduct.engine.api.EngineObjectData
11+ import viaduct.engine.api.mocks.MockEngineObjectData
1112import viaduct.engine.api.mocks.MockTenantModuleBootstrapper
1213import viaduct.engine.api.mocks.mkEngineObjectData
1314import viaduct.engine.api.mocks.mkSchemaWithWiring
@@ -591,6 +592,46 @@ class AccessCheckExecutionTest {
591592 }
592593 }
593594
595+ @Test
596+ fun `type check with rss - access checks skipped` () {
597+ MockTenantModuleBootstrapper (schema) {
598+ field(" Query" to " baz" ) {
599+ resolver {
600+ fn { _, _, _, _, ctx -> ctx.createNodeEngineObjectData(" 1" , bazType) }
601+ }
602+ }
603+ field(" Baz" to " y" ) {
604+ resolver {
605+ objectSelections(" x" )
606+ fn { _, obj, _, _, _ -> obj.fetch(" x" ).toString() }
607+ }
608+ checker {
609+ // Verifies that the access check for y shouldn't be applied
610+ // during fetch, otherwise the error would be "y checker failed"
611+ fn { _, _ -> throw RuntimeException (" y checker failed" ) }
612+ }
613+ }
614+ type(" Baz" ) {
615+ nodeUnbatchedExecutor { id, _, _ ->
616+ MockEngineObjectData (bazType, mapOf (" id" to id, " x" to id.toInt(), " y" to id))
617+ }
618+ checker {
619+ objectSelections(" key" , " fragment _ on Baz { y }" )
620+
621+ fn { _, objectDataMap ->
622+ if (objectDataMap[" key" ]!! .fetch(" y" ) == " 1" ) {
623+ return @fn Unit
624+ }
625+ }
626+ }
627+ }
628+ }.runFeatureTest {
629+ val result = viaduct.runQuery(" { baz { id } }" )
630+ assertEquals(mapOf (" baz" to mapOf (" id" to " 1" )), result.getData())
631+ assertEquals(0 , result.errors.size)
632+ }
633+ }
634+
594635 @Test
595636 fun `type checks with rss for list of objects - fail one of them` () {
596637 MockTenantModuleBootstrapper (schema) {
0 commit comments