Skip to content

Latest commit

 

History

History
202 lines (173 loc) · 2.63 KB

translator-tests-custom-scalars.adoc

File metadata and controls

202 lines (173 loc) · 2.63 KB

Translator Tests

Schema

scalar Date
type Movie {
  _id: ID!
  title: String!
  released: Date
}

Tests

Create

GraphQL-Query
mutation {
  createMovie(title:"Forrest Gump", released: 1994) {
    title
    released
  }
}
Cypher params
{
  "createMovieTitle": "Forrest Gump",
  "createMovieReleased": 1994
}
Cypher
CREATE (createMovie:Movie { title: $createMovieTitle, released: $createMovieReleased })
WITH createMovie
RETURN createMovie { .title, .released } AS createMovie

Update

GraphQL-Query
mutation {
  updateMovie(_id: 1, released: 1995) {
    title
    released
  }
}
Cypher params
{
  "updateMovie_id": 1,
  "updateMovieReleased": 1995
}
Cypher
MATCH (updateMovie: Movie)
WHERE ID(updateMovie) = toInteger($updateMovie_id)
SET updateMovie += { released: $updateMovieReleased }
WITH updateMovie
RETURN updateMovie { .title, .released } AS updateMovie

Merge

GraphQL-Query
mutation {
  mergeMovie(_id: 1, released: 1995) {
    title
    released
  }
}
Cypher params
{
  "mergeMovie_id": 1,
  "mergeMovieReleased": 1995
}
Cypher
MATCH (mergeMovie: Movie)
WHERE ID(mergeMovie) = toInteger($mergeMovie_id)
SET mergeMovie += { released: $mergeMovieReleased }
WITH mergeMovie
RETURN mergeMovie { .title, .released } AS mergeMovie

Merge null

GraphQL-Query
mutation {
  updateMovie(_id: 1, released: null) {
    title
    released
  }
}
Cypher params
{
  "updateMovie_id": 1,
  "updateMovieReleased": null
}
Cypher
MATCH (updateMovie: Movie)
WHERE ID(updateMovie) = toInteger($updateMovie_id)
SET updateMovie += { released: $updateMovieReleased }
WITH updateMovie
RETURN updateMovie { .title, .released } AS updateMovie

Find

GraphQL-Query
{
  movie(released: 1994) {
    title
    released
  }
}
Cypher params
{
  "movieReleased": 1994
}
Cypher
MATCH (movie: Movie)
WHERE movie.released = $movieReleased
RETURN movie { .title, .released } AS movie

Filter

GraphQL-Query
{
  movie(filter:{released_gte: 1994}) {
    title
    released
  }
}
Cypher params
{
  "filterMovieReleased_GTE": 1994
}
Cypher
MATCH (movie: Movie)
WHERE movie.released >= $filterMovieReleased_GTE
RETURN movie { .title, .released } AS movie