This repository has been archived by the owner on Sep 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 867
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2673 from prismagraphql/bugfix-related-field
bugfix: related field must not blow up when the related field has the same name
- Loading branch information
Showing
2 changed files
with
30 additions
and
6 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
server/servers/deploy/src/test/scala/com/prisma/shared/models/ModelsSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.prisma.shared.models | ||
|
||
import com.prisma.deploy.connector.MissingBackRelations | ||
import com.prisma.shared.schema_dsl.SchemaDsl | ||
import org.scalatest.{FlatSpec, Matchers} | ||
|
||
class ModelsSpec extends FlatSpec with Matchers { | ||
"a related field" should "be found when the related fields have the same name" in { | ||
val builder = SchemaDsl() | ||
val model1 = builder.model("Model1") | ||
val model2 = builder.model("Model2") | ||
model1.oneToOneRelation("field", "field", model2) | ||
val project = builder.buildProject() | ||
val withBackRelations = MissingBackRelations.add(project.schema) // should not blow up | ||
|
||
withBackRelations.allRelationFields.foreach { rf => | ||
rf.relatedField // let's see whether this blows up | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters