Skip to content

Commit

Permalink
Add unique type to interfaces top level tests
Browse files Browse the repository at this point in the history
  • Loading branch information
angrykoala committed Mar 5, 2024
1 parent 33cac47 commit 579e751
Showing 1 changed file with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ import { UniqueType } from "../../utils/graphql-types";
import Neo4jHelper from "../neo4j";

describe("Interfaces top level connections", () => {
const Movie = new UniqueType("Movie");
const Series = new UniqueType("Series");
const Season = new UniqueType("Season");
const ProgrammeItem = new UniqueType("ProgrammeItem");
const Actor = new UniqueType("Actor");

let schema: GraphQLSchema;
let driver: Driver;
Expand All @@ -49,23 +49,23 @@ describe("Interfaces top level connections", () => {
const typeDefs = /* GraphQL */ `
interface Show {
title: String!
actors: [Actor!]! @declareRelationship
actors: [${Actor}!]! @declareRelationship
}
type Movie implements Show {
type ${Movie} implements Show {
title: String!
cost: Float
runtime: Int
actors: [Actor!]! @relationship(type: "ACTED_IN", direction: IN, properties: "ActedIn")
actors: [${Actor}!]! @relationship(type: "ACTED_IN", direction: IN, properties: "ActedIn")
}
type Series implements Show {
type ${Series} implements Show {
title: String!
episodes: Int
actors: [Actor!]! @relationship(type: "ACTED_IN", direction: IN, properties: "ActedIn")
actors: [${Actor}!]! @relationship(type: "ACTED_IN", direction: IN, properties: "ActedIn")
}
type Actor {
type ${Actor} {
name: String!
actedIn: [Show!]! @relationship(type: "ACTED_IN", direction: OUT, properties: "ActedIn")
}
Expand All @@ -78,19 +78,19 @@ describe("Interfaces top level connections", () => {
schema = await neoGraphql.getSchema();

await neo4j.run(`
CREATE (m1:Movie {title: "The Matrix", cost: 24})
CREATE (:Movie {title: "The Godfather", cost: 20})
CREATE (:Series {title: "The Matrix Series", episodes: 4})
CREATE (s1:Series {title: "Avatar", episodes: 9})
CREATE (m1:${Movie} {title: "The Matrix", cost: 24})
CREATE (:${Movie} {title: "The Godfather", cost: 20})
CREATE (:${Series} {title: "The Matrix Series", episodes: 4})
CREATE (s1:${Series} {title: "Avatar", episodes: 9})
CREATE(a:Actor {name: "Arthur Dent"})
CREATE(a:${Actor} {name: "Arthur Dent"})
CREATE(a)-[:ACTED_IN {screenTime: 10}]->(m1)
CREATE(a)-[:ACTED_IN {screenTime: 20}]->(s1)
`);
});

afterEach(async () => {
await cleanNodes(driver, [Series, Season, ProgrammeItem]);
await cleanNodes(driver, [Series, Movie, Actor]);
});

afterAll(async () => {
Expand Down Expand Up @@ -133,7 +133,7 @@ describe("Interfaces top level connections", () => {
edges {
node {
title
... on Movie {
... on ${Movie} {
cost
}
}
Expand Down Expand Up @@ -169,7 +169,7 @@ describe("Interfaces top level connections", () => {
edges {
node {
title
... on Movie {
... on ${Movie} {
cost
}
}
Expand All @@ -193,7 +193,7 @@ describe("Interfaces top level connections", () => {
edges {
node {
title
... on Movie {
... on ${Movie} {
cost
}
}
Expand Down

0 comments on commit 579e751

Please sign in to comment.