neo4j-graphql-js
neo4j-graphql-js copied to clipboard
Non-atomic integration tests
Problem
@johnymontana explained to me in this comment that all the tests are expected to pass. What I have to do is to trash the database and re-import the data for each test run.
And indeed: When I run the the integration tests twice, I see all tests pass and next time some of them failing.
See how this looks like
robert@e480 ~/D/neo4j-graphql-js> npm run test-all
npm WARN lifecycle The node binary used for scripts is /home/robert/.asdf/shims/node but npm is using /home/robert/.asdf/installs/nodejs/10.15.1/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
> [email protected] test-all /home/robert/Development/neo4j-graphql-js
> nyc ava test/*.js test/neo4j-schema/*Test.js --verbose
✔ configTest › Config - makeAugmentedSchema - no queries, no mutations
✔ configTest › Config - augmentSchema - no queries, no mutations
✔ configTest › Config - makeAugmentedSchema - enable queries, no mutations
✔ filterTest › ID field equal to given value (164ms)
✔ configTest › Config - augmentSchema - enable queries, no mutations
✔ configTest › Config - makeAugmentedSchema - enable queries, enable mutations
✔ filterTest › ID field that starts with given substring
✔ configTest › Config - augmentSchema - enable queries, enable mutations
✔ filterTest › ID field that does NOT start with given substring
✔ configTest › Config - makeAugmentedSchema - specify types to exclude for mutation
✔ filterTest › ID field that ends with given substring
✔ configTest › Config - augmentSchema - specify types to exclude for mutation
✔ configTest › Config - makeAugmentedSchema - specify types to exclude for query
✔ filterTest › ID field that does NOT end with given substring
✔ filterTest › ID field that contains given substring
✔ configTest › Config - augmentSchema - specify types to exclude for query
✔ configTest › Config - temporal - disable temporal schema augmentation
✔ filterTest › ID field that does NOT contain given substring
✔ filterTest › ID field in given list
✔ filterTest › ID field NOT in given list
✔ filterTest › ID field different from given value
✔ augmentSchemaTest › Test augmented schema (198ms)
✔ filterTest › String field does NOT exist
✔ filterTest › String field exists
✔ filterTest › String field equal to given value (parameterized filter)
✔ filterTest › String field equal to given value (parameterized)
✔ filterTest › String field equal to given value
✔ filterTest › String field that starts with given substring
✔ filterTest › String field that does NOT start with given substring
✔ filterTest › String field that ends with given substring
✔ filterTest › String field that does NOT end with given substring
✔ filterTest › String field that contains given substring
✔ filterTest › String field that does NOT contain given substring
✔ filterTest › String field in given list
✔ filterTest › String field NOT in given list
✔ filterTest › String field different from given value
✔ filterTest › Boolean field equal to given value
✔ filterTest › Boolean field different from given value
✔ filterTest › Enum field equal to given value (parameterized)
✔ filterTest › Enum field different from given value (parameterized)
✔ filterTest › Enum field NOT in given list (parameterized)
✔ filterTest › Enum field in given list
✔ filterTest › Int field equal to given value
✔ filterTest › Int field in given list
✔ filterTest › Int field NOT in given list
✔ filterTest › Int field less than or equal to given value
✔ filterTest › Int field less than given value
✔ filterTest › Int field greater than given value
✔ filterTest › Int field greater than or equal to given value
✔ filterTest › Float field equal to given value
✔ filterTest › Float field different from given value
✔ filterTest › Float field in given list
✔ filterTest › Float field NOT in given list
✔ filterTest › Float field less than or equal to given value
✔ filterTest › Float field less than to given value
✔ filterTest › Float field greater than or equal to given value
✔ filterTest › Float field greater than given value
✔ filterTest › Boolean AND Float field OR String field equal to given value
✔ filterTest › Boolean AND String field equal to given value
✔ filterTest › Boolean AND String field equal to value given in separate filters
✔ filterTest › Boolean field equal to OR String field NOT equal to given value
✔ filterTest › Boolean field equal to given value OR String value in given list
✔ filterTest › Related node does NOT exist
✔ filterTest › Related node exists
✔ filterTest › ALL related nodes matching filter
✔ filterTest › ALL related nodes NOT matching filter
✔ filterTest › ALL related nodes matching filter in given list
✔ filterTest › ALL related nodes NOT matching filter in given list
✔ filterTest › ALL related nodes matching filter nested in given logical OR filters
✔ filterTest › String field equal to given value AND String field on ALL related nodes ends with given substring (parameterized filter)
✔ filterTest › ALL related nodes matching String field equal to given value
✔ filterTest › ALL related nodes matching filter given in separate OR filters
✔ filterTest › ALL related nodes matching String field in given list
✔ filterTest › SOME related nodes matching given filter
✔ filterTest › EVERY related node matching given filter
✔ filterTest › NONE of any related nodes match given filter
✔ filterTest › SINGLE related node matching given filter
✔ filterTest › Nested relationship filter
✔ filterTest › Temporal field equal to given value
✔ filterTest › Temporal field different from given value
✔ filterTest › Temporal field before or equal to given value
✔ filterTest › Temporal field before given value
✔ filterTest › Temporal field after or equal to given value
✔ filterTest › Temporal field after given value
✔ filterTest › Temporal field in given list
✔ neo4j-schema › typesTest › label2GraphQLType
✔ neo4j-schema › typesTest › chooseGraphQLType
✔ filterTest › Temporal field NOT in given list
✔ filterTest › Temporal field does NOT exist
✔ filterTest › Temporal field exists
✔ filterTest › Temporal field does NOT exist on related node
✔ filterTest › Temporal field on related node equal to given value
✔ filterTest › Temporal field on related node equal to given year OR formatted value OR does NOT exist
✔ filterTest › Temporal and scalar field on relationship match given logical AND filters
✔ filterTest › Related node does NOT exist (relationship type)
✔ filterTest › Related node exists (relationship type)
✔ filterTest › Temporal fields on relationship do NOT exist
✔ filterTest › Temporal fields on relationship exist
✔ filterTest › Temporal fields on relationship equal to given values
✔ filterTest › ALL relationships matching filter
✔ filterTest › ALL relationships NOT matching filter
✔ filterTest › SOME relationships matching given filter
✔ filterTest › EVERY relationship matching given filter
✔ filterTest › NONE of any relationships match given filter
✔ filterTest › SINGLE relationship matching given filter
✔ neo4j-schema › Neo4jSchemaTreeTest › Driver ownership
Initializing your Neo4j Schema
This may take a few moments depending on the size of your DB
✔ filterTest › Scalar fields on relationship AND related node equal to given values
Initializing your Neo4j Schema
This may take a few moments depending on the size of your DB
Initializing your Neo4j Schema
This may take a few moments depending on the size of your DB
✔ filterTest › ALL relationships matching filter in given list
✔ cypherTest › Handle @cypher directive on Mutation type
✔ filterTest › ALL relationships NOT matching filter in given list
✔ filterTest › ALL outgoing reflexive type relationships matching filter
✔ cypherTest › Handle @cypher directive on Mutation type with nested @cypher directive on field
✔ filterTest › ALL incoming reflexive type relationships NOT matching filter
✔ neo4j-schema › Neo4jSchemaTreeTest › Initialize
✔ neo4j-schema › Neo4jSchemaTreeTest › Link Establishment
✔ neo4j-schema › Neo4jSchemaTreeTest › toJSON
✔ filterTest › ALL outgoing reflexive type relationships matching given filter
✔ cypherTest › Create node mutation
✔ filterTest › SOME incoming reflexive type relationships matching given filter
✔ cypherTest › Update node mutation
✔ cypherTest › Delete node mutation
✔ filterTest › EVERY incoming and outgoing reflexive type relationship matching given filters
✔ filterTest › NONE of any incoming and outgoing reflexive type relationships match given filters
✔ filterTest › SINGLE incoming reflexive type relationships matching given filter
✔ filterTest › ALL outgoing reflexive relationships matching filter in given list
✔ filterTest › ALL incoming reflexive relationships NOT matching filter in given list
✔ filterTest › Incoming and outgoing reflexive relationships do NOT exist
✔ filterTest › Deeply nested list filters containing differences
✔ filterTest › Nested filter on relationship field
✔ filterTest › Nested filter on relationship type field
✔ filterTest › Nested filters on reflexive relationship type field
Relationship :BUYS has no properties and does not need to be generated
Relationship :LIVES_IN has no properties and does not need to be generated
✔ neo4j-schema › graphQLMapperTest › Basic Mapping Result Structure
✔ neo4j-schema › graphQLMapperTest › Defines a GraphQL type per node
✔ neo4j-schema › graphQLMapperTest › All nodes get an _id property to permit propertyless-node labels to work
type Customer {
_id: Long!
age: Integer
name: String!
buys: [Product] @relation(name: "BUYS", direction: "OUT")
reviewed: [Product] @relation(name: "REVIEWED", direction: "OUT")
REVIEWED_rel: [REVIEWED]
lives_in: [State] @relation(name: "LIVES_IN", direction: "OUT")
}
type Product {
_id: Long!
sku: String!
customers_buys: [Customer] @relation(name: "BUYS", direction: "IN")
customers_reviewed: [Customer] @relation(name: "REVIEWED", direction: "IN")
}
type State {
_id: Long!
name: String!
customers: [Customer] @relation(name: "LIVES_IN", direction: "IN")
}
type REVIEWED @relation(name: "REVIEWED") {
from: Customer!
to: Product!
stars: Integer
}
✔ neo4j-schema › graphQLMapperTest › Defines properties with correct types
✔ neo4j-schema › graphQLMapperTest › Defines relationships BOTH WAYS with right order and @relation directive
✔ neo4j-schema › graphQLMapperTest › Deconflicts names for multi-targeted relationships by using relationship label
type Customer {
_id: Long!
age: Integer
name: String!
buys: [Product] @relation(name: "BUYS", direction: "OUT")
reviewed: [Product] @relation(name: "REVIEWED", direction: "OUT")
REVIEWED_rel: [REVIEWED]
lives_in: [State] @relation(name: "LIVES_IN", direction: "OUT")
}
type Product {
_id: Long!
sku: String!
customers_buys: [Customer] @relation(name: "BUYS", direction: "IN")
customers_reviewed: [Customer] @relation(name: "REVIEWED", direction: "IN")
}
type State {
_id: Long!
name: String!
customers: [Customer] @relation(name: "LIVES_IN", direction: "IN")
}
type REVIEWED @relation(name: "REVIEWED") {
from: Customer!
to: Product!
stars: Integer
}
✔ neo4j-schema › graphQLMapperTest › Defines relationship types with properties
✔ neo4j-schema › entitiesTest › Neo4jNode basics
✔ neo4j-schema › entitiesTest › SchemaEntity properties
✔ neo4j-schema › entitiesTest › Neo4jNode labels
✔ neo4j-schema › entitiesTest › Neo4jNode graphQLType
✔ neo4j-schema › entitiesTest › Neo4jRelationship basics
✔ neo4j-schema › entitiesTest › Neo4jRelationship type
✔ neo4j-schema › entitiesTest › Neo4jRelationship graphQLTypeName
✔ neo4j-schema › entitiesTest › Neo4j Relationship Links
✔ neo4j-schema › entitiesTest › Neo4j Univalent/Multivalent Relationships
✔ middleware › Middleware fail on req.error (107ms)
✔ cypherTest › Add relationship mutation (2.9s)
✔ cypherTest › Add relationship mutation with GraphQL variables (2.9s)
✔ cypherTest › Add relationship mutation with relationship property (2.8s)
✔ cypherTest › Add reflexive relationship mutation with relationship property (2.7s)
✔ cypherTest › Remove relationship mutation (2.6s)
✔ cypherTest › Remove reflexive relationship mutation (2.6s)
✔ cypherTest › orderBy test - descending, top level - augmented schema (1.9s)
✔ cypherTest › query for relationship properties (1.8s)
✔ cypherTest › query reflexive relation nested in non-reflexive relation (1.8s)
✔ cypherTest › query non-reflexive relation nested in reflexive relation (1.8s)
✔ cypherTest › query relation type with argument (1.7s)
✔ cypherTest › query reflexive relation type with arguments (1.7s)
✔ cypherTest › query using inline fragment (1.6s)
✔ cypherTest › Create node with temporal properties (1.6s)
✔ cypherTest › Query node with temporal properties using temporal arguments (1.5s)
✔ cypherTest › Nested Query with temporal property arguments (1.5s)
✔ cypherTest › Update temporal and non-temporal properties on node using temporal property node selection (1.4s)
✔ cypherTest › Update temporal list property on node using temporal property node selection (1.4s)
✔ cypherTest › Delete node using temporal property node selection (1.4s)
✔ cypherTest › Add relationship mutation using temporal property node selection (1.4s)
✔ cypherTest › Remove relationship mutation using temporal property node selection (1.3s)
✔ cypherTest › Query relationship with temporal properties (1.3s)
✔ cypherTest › Add relationship mutation with temporal properties (1.2s)
✔ cypherTest › Add relationship mutation with list properties (1.2s)
✔ cypherTest › Add reflexive relationship mutation with temporal properties (1.2s)
✔ cypherTest › Remove relationship mutation for relation type field (1.1s)
✔ cypherTest › Query nested temporal properties on reflexive relationship using temporal arguments (1.1s)
✔ cypherTest › Query nested temporal properties on relationships using temporal arguments (1.1s)
✔ cypherTest › Query nested list properties on relationship (1.1s)
✔ cypherTest › UUID value generated if no id value provided (1s)
✔ cypherTest › Create node with list arguments (971ms)
✔ cypherTest › simple Cypher query (5.4s)
✔ cypherTest › Simple skip limit (5.1s)
✔ cypherTest › Cypher projection skip limit (5s)
✔ cypherTest › Handle Query with name not aligning to type (4.8s)
✔ cypherTest › Query without arguments, non-null type (4.7s)
✔ cypherTest › Query single object (4.6s)
✔ cypherTest › Query single object relation (4.5s)
✔ cypherTest › Query single object and array of objects relations (4.4s)
✔ cypherTest › Deeply nested object query (4.4s)
✔ cypherTest › Handle meta field at beginning of selection set (4.3s)
✔ cypherTest › Handle meta field at end of selection set (4.2s)
✔ cypherTest › Handle meta field in middle of selection set (4.1s)
✔ cypherTest › Handle @cypher directive without any params for sub-query (4.1s)
✔ cypherTest › Pass @cypher directive default params to sub-query (4s)
✔ cypherTest › Pass @cypher directive params to sub-query (3.9s)
✔ cypherTest › Query for Neo4js internal _id (3.8s)
✔ cypherTest › Query for Neo4js internal _id and another param before _id (3.8s)
✔ cypherTest › Query for Neo4js internal _id and another param after _id (3.7s)
✔ cypherTest › Query for Neo4js internal _id by dedicated Query MovieBy_Id(_id: String!) (3.6s)
✔ cypherTest › Query for null value translates to 'IS NULL' WHERE clause (3.6s)
✔ cypherTest › Query for null value combined with internal ID and another param (3.5s)
✔ cypherTest › Cypher subquery filters (3.4s)
✔ cypherTest › Cypher subquery filters with paging (3.3s)
✔ cypherTest › Handle @cypher directive on Query Type (3.2s)
✔ cypherTest › Handle GraphQL variables in nested selection - first/offset (2.5s)
✔ cypherTest › Handle GraphQL variables in nest selection - @cypher param (not first/offset) (2.4s)
✔ cypherTest › Return internal node id for _id field (2.4s)
✔ cypherTest › Treat enum as a scalar (2.3s)
✔ cypherTest › Handle query fragment (2.2s)
✔ cypherTest › Handle multiple query fragments (2.2s)
✔ cypherTest › nested fragments (2.1s)
✔ cypherTest › fragments on relations (2s)
✔ cypherTest › nested fragments on relations (2s)
✔ cypherTest › Cypher array queries (935ms)
✔ cypherTest › Cypher array sub queries (910ms)
✔ cypherTest › Create node with non-null field (875ms)
✔ cypherTest › Query node with ignored field (851ms)
✔ cypherTest › Deeply nested orderBy (820ms)
✔ cypherTest › Query using enum orderBy (800ms)
✔ cypherTest › Query using temporal orderBy (770ms)
✔ cypherTest › Deeply nested query using temporal orderBy (738ms)
✔ cypherTest › Handle @cypher field with String payload using cypherParams (717ms)
✔ cypherTest › Handle nested @cypher fields that use cypherParams (679ms)
✔ cypherTest › Handle @cypher query using cypherParams with String payload (658ms)
✔ cypherTest › Handle @cypher query using cypherParams with Object payload (614ms)
✔ cypherTest › Handle @cypher query with Boolean payload (587ms)
✔ cypherTest › Handle @cypher query with Int payload (555ms)
✔ cypherTest › Handle @cypher query with Float payload (501ms)
✔ cypherTest › Handle @cypher query with String list payload (475ms)
✔ cypherTest › Handle @cypher query with Int list payload (428ms)
✔ cypherTest › Handle @cypher query with Temporal payload (382ms)
✔ cypherTest › Handle @cypher mutation using cypherParams with String payload (335ms)
✔ cypherTest › Handle @cypher mutation using cypherParams with Object payload (292ms)
✔ cypherTest › Handle @cypher mutation with String list payload (256ms)
✔ cypherTest › Handle @cypher mutation with Temporal payload (219ms)
✔ cypherTest › Handle nested @cypher fields using parameterized arguments and cypherParams (170ms)
✔ cypherTest › Handle @cypher mutation with input type argument (147ms)
✔ cypherTest › Handle @cypher query with parameterized input type argument (103ms)
✔ cypherTest › Handle @cypher field on root query type with scalar payload, no args
✔ cypherTest › Handle @cypher field with parameterized value for field of input type argument
✔ integration › Add relationship mutation (722ms)
✔ integration › Remove relationship mutation (197ms)
✔ integration › Temporal - Create node with temporal property (289ms)
✔ integration › Temporal - Create node with multiple temporal fields and input formats (132ms)
✔ integration › Temporal - Create node with multiple temporal fields and input formats - with GraphQL variables
✔ integration › Temporal - Query node with temporal field (218ms)
✔ integration › Temporal - create node with only a temporal property
✔ integration › Temporal - temporal query argument, components
✔ integration › Temporal - temporal query argument, formatted
✔ integration › Add relationship with temporal property
✔ integration › Query for temporal property on relationship
✔ integration › hello world
✔ integration › basic GraphQL query (410ms)
✔ integration › Create node mutation (508ms)
✔ integration › Mutation with @cypher directive (560ms)
✔ integration › Update node mutation (847ms)
✔ integration › query relationship property data (879ms)
✔ integration › Delete node mutation (962ms)
✔ integration › Basic filter (1.1s)
✔ integration › Handle @cypher directive on QueryType (1.2s)
✔ integration › Top level orderBy (1.3s)
✔ integration › Filter with AND (1.4s)
✔ integration › GraphQL query with @cypher directive (1.4s)
✔ integration › query using inine fragment (1.5s)
✔ integration › Filter with OR (1.5s)
✔ integration › Filter in selection (1.6s)
✔ integration › Filter with nested AND and OR (1.6s)
✔ integration › Nested filter (2.1s)
✔ integration › Filter with GraphQL variable (2.1s)
268 tests passed
---------------------|----------|----------|----------|----------|-------------------|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
---------------------|----------|----------|----------|----------|-------------------|
All files | 94.87 | 83.12 | 94.99 | 95.05 | |
dist | 94.91 | 83.31 | 94.37 | 95.12 | |
augment.js | 95.58 | 84.78 | 95.92 | 95.94 |... 1008,1012,1242 |
auth.js | 82.76 | 64.15 | 85.71 | 81.82 |... 56,59,60,63,71 |
index.js | 65.65 | 39.34 | 53.85 | 66.15 |... 29,261,263,265 |
selections.js | 91.2 | 76.32 | 71.43 | 91.2 |... 40,141,143,144 |
translate.js | 99.19 | 92.15 | 100 | 99.18 |... 2002,2003,2004 |
utils.js | 93.4 | 82.18 | 95.04 | 93.96 |... 1039,1044,1045 |
dist/neo4j-schema | 94.48 | 80.37 | 97.12 | 94.48 | |
Neo4jSchemaTree.js | 98.11 | 81.25 | 97.73 | 98.11 | 155,224 |
entities.js | 96.1 | 80 | 93.1 | 96.1 | 61,70,91 |
graphQLMapper.js | 89.81 | 72.97 | 100 | 89.81 |... 81,183,207,208 |
types.js | 94.29 | 88.24 | 100 | 94.29 | 101,107 |
---------------------|----------|----------|----------|----------|-------------------|
robert@e480 ~/D/neo4j-graphql-js> npm run test-all
npm WARN lifecycle The node binary used for scripts is /home/robert/.asdf/shims/node but npm is using /home/robert/.asdf/installs/nodejs/10.15.1/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
> [email protected] test-all /home/robert/Development/neo4j-graphql-js
> nyc ava test/*.js test/neo4j-schema/*Test.js --verbose
✔ configTest › Config - makeAugmentedSchema - no queries, no mutations (105ms)
✔ configTest › Config - augmentSchema - no queries, no mutations
✔ configTest › Config - makeAugmentedSchema - enable queries, no mutations
✔ filterTest › ID field equal to given value (210ms)
✔ configTest › Config - augmentSchema - enable queries, no mutations
✔ configTest › Config - makeAugmentedSchema - enable queries, enable mutations
✔ filterTest › ID field that starts with given substring
✔ filterTest › ID field that does NOT start with given substring
✔ configTest › Config - augmentSchema - enable queries, enable mutations
✔ augmentSchemaTest › Test augmented schema (247ms)
✔ filterTest › ID field that ends with given substring
✔ configTest › Config - makeAugmentedSchema - specify types to exclude for mutation
✔ filterTest › ID field that does NOT end with given substring
✔ filterTest › ID field that contains given substring
✔ configTest › Config - augmentSchema - specify types to exclude for mutation
✔ filterTest › ID field that does NOT contain given substring
✔ configTest › Config - makeAugmentedSchema - specify types to exclude for query
✔ filterTest › ID field in given list
✔ configTest › Config - augmentSchema - specify types to exclude for query
✔ configTest › Config - temporal - disable temporal schema augmentation
✔ filterTest › ID field NOT in given list
✔ filterTest › ID field different from given value
✔ filterTest › String field does NOT exist
✔ filterTest › String field exists
✔ filterTest › String field equal to given value (parameterized filter)
✔ filterTest › String field equal to given value (parameterized)
✔ filterTest › String field equal to given value
✔ filterTest › String field that starts with given substring
✔ filterTest › String field that does NOT start with given substring
✔ filterTest › String field that ends with given substring
✔ filterTest › String field that does NOT end with given substring
✔ filterTest › String field that contains given substring
✔ filterTest › String field that does NOT contain given substring
✔ filterTest › String field in given list
✔ filterTest › String field NOT in given list
✔ filterTest › String field different from given value
✔ filterTest › Boolean field equal to given value
✔ filterTest › Boolean field different from given value
✔ filterTest › Enum field equal to given value (parameterized)
✔ filterTest › Enum field different from given value (parameterized)
✔ filterTest › Enum field NOT in given list (parameterized)
✔ filterTest › Enum field in given list
✔ filterTest › Int field equal to given value
✔ filterTest › Int field in given list
✔ filterTest › Int field NOT in given list
✔ filterTest › Int field less than or equal to given value
✔ filterTest › Int field less than given value
✔ filterTest › Int field greater than given value
✔ filterTest › Int field greater than or equal to given value
✔ filterTest › Float field equal to given value
✔ filterTest › Float field different from given value
✔ filterTest › Float field in given list
✔ filterTest › Float field NOT in given list
✔ filterTest › Float field less than or equal to given value
✔ filterTest › Float field less than to given value
✔ filterTest › Float field greater than or equal to given value
✔ filterTest › Float field greater than given value
✔ filterTest › Boolean AND Float field OR String field equal to given value
✔ filterTest › Boolean AND String field equal to given value
✔ filterTest › Boolean AND String field equal to value given in separate filters
✔ filterTest › Boolean field equal to OR String field NOT equal to given value
✔ filterTest › Boolean field equal to given value OR String value in given list
✔ filterTest › Related node does NOT exist
✔ filterTest › Related node exists
✔ filterTest › ALL related nodes matching filter
✔ filterTest › ALL related nodes NOT matching filter
✔ filterTest › ALL related nodes matching filter in given list
✔ filterTest › ALL related nodes NOT matching filter in given list
✔ filterTest › ALL related nodes matching filter nested in given logical OR filters
✔ filterTest › String field equal to given value AND String field on ALL related nodes ends with given substring (parameterized filter)
✔ filterTest › ALL related nodes matching String field equal to given value
✔ neo4j-schema › typesTest › label2GraphQLType
✔ neo4j-schema › typesTest › chooseGraphQLType
✔ filterTest › ALL related nodes matching filter given in separate OR filters
✔ filterTest › ALL related nodes matching String field in given list
✔ filterTest › SOME related nodes matching given filter
✔ filterTest › EVERY related node matching given filter
✔ filterTest › NONE of any related nodes match given filter
✔ filterTest › SINGLE related node matching given filter
✔ filterTest › Nested relationship filter
✔ filterTest › Temporal field equal to given value
✔ filterTest › Temporal field different from given value
✔ filterTest › Temporal field before or equal to given value
✔ filterTest › Temporal field before given value
✔ filterTest › Temporal field after or equal to given value
✔ filterTest › Temporal field after given value
✔ filterTest › Temporal field in given list
✔ filterTest › Temporal field NOT in given list
✔ filterTest › Temporal field does NOT exist
✔ filterTest › Temporal field exists
✔ filterTest › Temporal field does NOT exist on related node
✔ neo4j-schema › Neo4jSchemaTreeTest › Driver ownership
Initializing your Neo4j Schema
This may take a few moments depending on the size of your DB
Initializing your Neo4j Schema
This may take a few moments depending on the size of your DB
Initializing your Neo4j Schema
This may take a few moments depending on the size of your DB
✔ filterTest › Temporal field on related node equal to given value
✔ neo4j-schema › Neo4jSchemaTreeTest › Initialize
✔ neo4j-schema › Neo4jSchemaTreeTest › Link Establishment
✔ neo4j-schema › Neo4jSchemaTreeTest › toJSON
✔ filterTest › Temporal field on related node equal to given year OR formatted value OR does NOT exist
✔ filterTest › Temporal and scalar field on relationship match given logical AND filters
✔ filterTest › Related node does NOT exist (relationship type)
✔ filterTest › Related node exists (relationship type)
✔ filterTest › Temporal fields on relationship do NOT exist
✔ cypherTest › Handle @cypher directive on Mutation type
✔ cypherTest › Handle @cypher directive on Mutation type with nested @cypher directive on field
✔ filterTest › Temporal fields on relationship exist
✔ cypherTest › Create node mutation
✔ cypherTest › Update node mutation
✔ filterTest › Temporal fields on relationship equal to given values
✔ cypherTest › Delete node mutation
✔ filterTest › ALL relationships matching filter
✔ filterTest › ALL relationships NOT matching filter
✔ filterTest › SOME relationships matching given filter
✔ filterTest › EVERY relationship matching given filter
✔ filterTest › NONE of any relationships match given filter
✔ filterTest › SINGLE relationship matching given filter
✔ filterTest › Scalar fields on relationship AND related node equal to given values
✔ filterTest › ALL relationships matching filter in given list
✔ filterTest › ALL relationships NOT matching filter in given list
✔ filterTest › ALL outgoing reflexive type relationships matching filter
✔ filterTest › ALL incoming reflexive type relationships NOT matching filter
✔ filterTest › ALL outgoing reflexive type relationships matching given filter
✔ filterTest › SOME incoming reflexive type relationships matching given filter
✔ filterTest › EVERY incoming and outgoing reflexive type relationship matching given filters
✔ filterTest › NONE of any incoming and outgoing reflexive type relationships match given filters
✔ filterTest › SINGLE incoming reflexive type relationships matching given filter
✔ filterTest › ALL outgoing reflexive relationships matching filter in given list
✔ filterTest › ALL incoming reflexive relationships NOT matching filter in given list
✔ filterTest › Incoming and outgoing reflexive relationships do NOT exist
✔ filterTest › Deeply nested list filters containing differences
✔ filterTest › Nested filter on relationship field
✔ filterTest › Nested filter on relationship type field
✔ filterTest › Nested filters on reflexive relationship type field
Relationship :BUYS has no properties and does not need to be generated
Relationship :LIVES_IN has no properties and does not need to be generated
✔ neo4j-schema › graphQLMapperTest › Basic Mapping Result Structure
✔ neo4j-schema › graphQLMapperTest › Defines a GraphQL type per node
✔ neo4j-schema › graphQLMapperTest › All nodes get an _id property to permit propertyless-node labels to work
type Customer {
_id: Long!
age: Integer
name: String!
buys: [Product] @relation(name: "BUYS", direction: "OUT")
reviewed: [Product] @relation(name: "REVIEWED", direction: "OUT")
REVIEWED_rel: [REVIEWED]
lives_in: [State] @relation(name: "LIVES_IN", direction: "OUT")
}
type Product {
_id: Long!
sku: String!
customers_buys: [Customer] @relation(name: "BUYS", direction: "IN")
customers_reviewed: [Customer] @relation(name: "REVIEWED", direction: "IN")
}
type State {
_id: Long!
name: String!
customers: [Customer] @relation(name: "LIVES_IN", direction: "IN")
}
type REVIEWED @relation(name: "REVIEWED") {
from: Customer!
to: Product!
stars: Integer
}
✔ neo4j-schema › graphQLMapperTest › Defines properties with correct types
✔ neo4j-schema › graphQLMapperTest › Defines relationships BOTH WAYS with right order and @relation directive
✔ neo4j-schema › graphQLMapperTest › Deconflicts names for multi-targeted relationships by using relationship label
✔ neo4j-schema › graphQLMapperTest › Defines relationship types with properties
type Customer {
_id: Long!
age: Integer
name: String!
buys: [Product] @relation(name: "BUYS", direction: "OUT")
reviewed: [Product] @relation(name: "REVIEWED", direction: "OUT")
REVIEWED_rel: [REVIEWED]
lives_in: [State] @relation(name: "LIVES_IN", direction: "OUT")
}
type Product {
_id: Long!
sku: String!
customers_buys: [Customer] @relation(name: "BUYS", direction: "IN")
customers_reviewed: [Customer] @relation(name: "REVIEWED", direction: "IN")
}
type State {
_id: Long!
name: String!
customers: [Customer] @relation(name: "LIVES_IN", direction: "IN")
}
type REVIEWED @relation(name: "REVIEWED") {
from: Customer!
to: Product!
stars: Integer
}
✔ neo4j-schema › entitiesTest › Neo4jNode basics
✔ neo4j-schema › entitiesTest › SchemaEntity properties
✔ neo4j-schema › entitiesTest › Neo4jNode labels
✔ neo4j-schema › entitiesTest › Neo4jNode graphQLType
✔ neo4j-schema › entitiesTest › Neo4jRelationship basics
✔ neo4j-schema › entitiesTest › Neo4jRelationship type
✔ neo4j-schema › entitiesTest › Neo4jRelationship graphQLTypeName
✔ neo4j-schema › entitiesTest › Neo4j Relationship Links
✔ neo4j-schema › entitiesTest › Neo4j Univalent/Multivalent Relationships
✔ middleware › Middleware fail on req.error
✔ integration › Add relationship mutation
✔ integration › Remove relationship mutation
✔ integration › Temporal - Create node with temporal property
✔ integration › Temporal - Create node with multiple temporal fields and input formats
✔ integration › Temporal - Create node with multiple temporal fields and input formats - with GraphQL variables
✖ integration › Temporal - Query node with temporal field
✔ integration › Temporal - create node with only a temporal property
✖ integration › Temporal - temporal query argument, components
✖ integration › Temporal - temporal query argument, formatted
✔ integration › Add relationship with temporal property
✖ integration › Query for temporal property on relationship
✔ integration › hello world
✖ integration › Mutation with @cypher directive Error: GraphQL error: Node(32374) already exists with label `Genre` and property `name` = 'Wildlife Documentary'
✖ integration › Create node mutation Error: GraphQL error: Node(32355) already exists with label `Movie` and property `movieId` = '12dd334d5zaaaa'
✔ integration › Handle @cypher directive on QueryType (226ms)
✔ integration › Update node mutation (226ms)
✔ integration › Delete node mutation (272ms)
✔ integration › GraphQL query with @cypher directive (326ms)
✔ integration › Top level orderBy (332ms)
✔ integration › basic GraphQL query (353ms)
✔ integration › Basic filter (359ms)
✔ integration › query relationship property data (371ms)
✔ integration › query using inine fragment (404ms)
✔ integration › Filter with AND (452ms)
✔ integration › Filter with OR (614ms)
✔ integration › Filter in selection (663ms)
✔ integration › Filter with nested AND and OR (706ms)
✔ cypherTest › Add relationship mutation (3.5s)
✔ cypherTest › Add relationship mutation with GraphQL variables (3.4s)
✔ cypherTest › Add relationship mutation with relationship property (3.3s)
✔ cypherTest › Add reflexive relationship mutation with relationship property (3.2s)
✔ cypherTest › Remove relationship mutation (3.1s)
✔ cypherTest › Remove reflexive relationship mutation (3.1s)
✔ cypherTest › orderBy test - descending, top level - augmented schema (2.4s)
✔ cypherTest › query for relationship properties (2.4s)
✔ cypherTest › query reflexive relation nested in non-reflexive relation (2.3s)
✔ cypherTest › query non-reflexive relation nested in reflexive relation (2.3s)
✔ cypherTest › query relation type with argument (2.2s)
✔ cypherTest › query reflexive relation type with arguments (2.2s)
✔ cypherTest › query using inline fragment (2.2s)
✔ cypherTest › Create node with temporal properties (2.1s)
✔ cypherTest › Query node with temporal properties using temporal arguments (2s)
✔ cypherTest › Nested Query with temporal property arguments (2s)
✔ cypherTest › Update temporal and non-temporal properties on node using temporal property node selection (2s)
✔ cypherTest › Update temporal list property on node using temporal property node selection (1.9s)
✔ cypherTest › Delete node using temporal property node selection (1.9s)
✔ cypherTest › Add relationship mutation using temporal property node selection (1.9s)
✔ cypherTest › Remove relationship mutation using temporal property node selection (1.8s)
✔ cypherTest › Query relationship with temporal properties (1.8s)
✔ cypherTest › Add relationship mutation with temporal properties (1.7s)
✔ cypherTest › Add relationship mutation with list properties (1.7s)
✔ cypherTest › Add reflexive relationship mutation with temporal properties (1.7s)
✔ cypherTest › Remove relationship mutation for relation type field (1.6s)
✔ cypherTest › Query nested temporal properties on reflexive relationship using temporal arguments (1.6s)
✔ cypherTest › Query nested temporal properties on relationships using temporal arguments (1.5s)
✔ cypherTest › Query nested list properties on relationship (1.5s)
✔ cypherTest › UUID value generated if no id value provided (1.5s)
✔ cypherTest › Create node with list arguments (1.4s)
✔ cypherTest › simple Cypher query (5.8s)
✔ cypherTest › Simple skip limit (5.4s)
✔ cypherTest › Cypher projection skip limit (5.3s)
✔ cypherTest › Handle Query with name not aligning to type (5.2s)
✔ cypherTest › Query without arguments, non-null type (5.1s)
✔ cypherTest › Query single object (5s)
✔ cypherTest › Query single object relation (5s)
✔ cypherTest › Query single object and array of objects relations (4.9s)
✔ cypherTest › Deeply nested object query (4.8s)
✔ cypherTest › Handle meta field at beginning of selection set (4.7s)
✔ cypherTest › Handle meta field at end of selection set (4.7s)
✔ cypherTest › Handle meta field in middle of selection set (4.6s)
✔ cypherTest › Handle @cypher directive without any params for sub-query (4.5s)
✔ cypherTest › Pass @cypher directive default params to sub-query (4.5s)
✔ cypherTest › Pass @cypher directive params to sub-query (4.4s)
✔ cypherTest › Query for Neo4js internal _id (4.4s)
✔ cypherTest › Query for Neo4js internal _id and another param before _id (4.3s)
✔ cypherTest › Query for Neo4js internal _id and another param after _id (4.2s)
✔ cypherTest › Query for Neo4js internal _id by dedicated Query MovieBy_Id(_id: String!) (4.1s)
✔ cypherTest › Query for null value translates to 'IS NULL' WHERE clause (4.1s)
✔ cypherTest › Query for null value combined with internal ID and another param (4s)
✔ cypherTest › Cypher subquery filters (3.9s)
✔ cypherTest › Cypher subquery filters with paging (3.8s)
✔ cypherTest › Handle @cypher directive on Query Type (3.7s)
✔ cypherTest › Handle GraphQL variables in nested selection - first/offset (3s)
✔ cypherTest › Handle GraphQL variables in nest selection - @cypher param (not first/offset) (2.9s)
✔ cypherTest › Return internal node id for _id field (2.8s)
✔ cypherTest › Treat enum as a scalar (2.7s)
✔ cypherTest › Handle query fragment (2.7s)
✔ cypherTest › Handle multiple query fragments (2.6s)
✔ cypherTest › nested fragments (2.6s)
✔ cypherTest › fragments on relations (2.5s)
✔ cypherTest › nested fragments on relations (2.5s)
✔ cypherTest › Cypher array queries (1.4s)
✔ cypherTest › Cypher array sub queries (1.4s)
✔ cypherTest › Create node with non-null field (1.3s)
✔ cypherTest › Query node with ignored field (1.3s)
✔ cypherTest › Deeply nested orderBy (1.3s)
✔ cypherTest › Query using enum orderBy (1.3s)
✔ cypherTest › Query using temporal orderBy (1.2s)
✔ cypherTest › Deeply nested query using temporal orderBy (1.2s)
✔ cypherTest › Handle @cypher field with String payload using cypherParams (1.2s)
✔ cypherTest › Handle nested @cypher fields that use cypherParams (1.1s)
✔ cypherTest › Handle @cypher query using cypherParams with String payload (1.1s)
✔ cypherTest › Handle @cypher query using cypherParams with Object payload (1.1s)
✔ cypherTest › Handle @cypher query with Boolean payload (984ms)
✔ cypherTest › Handle @cypher query with Int payload (843ms)
✔ cypherTest › Handle @cypher query with Float payload (786ms)
✔ cypherTest › Handle @cypher query with String list payload (696ms)
✔ cypherTest › Handle @cypher query with Int list payload (641ms)
✔ cypherTest › Handle @cypher query with Temporal payload (569ms)
✔ cypherTest › Handle @cypher mutation using cypherParams with String payload (520ms)
✔ cypherTest › Handle @cypher mutation using cypherParams with Object payload (450ms)
✔ cypherTest › Handle @cypher mutation with String list payload (403ms)
✔ cypherTest › Handle @cypher mutation with Temporal payload (342ms)
✔ cypherTest › Handle nested @cypher fields using parameterized arguments and cypherParams (275ms)
✔ cypherTest › Handle @cypher mutation with input type argument (221ms)
✔ cypherTest › Handle @cypher query with parameterized input type argument (161ms)
✔ cypherTest › Handle @cypher field on root query type with scalar payload, no args (103ms)
✔ cypherTest › Handle @cypher field with parameterized value for field of input type argument
✔ integration › Nested filter (883ms)
✔ integration › Filter with GraphQL variable (919ms)
6 tests failed
integration › Temporal - Query node with temporal field
/home/robert/Development/neo4j-graphql-js/test/integration.js:877
876: .then(data => {
877: t.deepEqual(data.data, expected.data);
878: })
Difference:
{
Movie: [
Object { … },
- {
- __typename: 'Movie',
- date: {
- __typename: '_Neo4jDate',
- formatted: '2010-01-02',
- },
- dateTime: {
- __typename: '_Neo4jDateTime',
- day: 2,
- hour: 0,
- millisecond: 0,
- minute: 0,
- month: 1,
- nanosecond: 0,
- second: 0,
- timezone: 'Z',
- year: 2010,
- },
- localDateTime: {
- __typename: '_Neo4jLocalDateTime',
- day: 2,
- formatted: '2010-01-02T00:00:00',
- hour: 0,
- minute: 0,
- month: 1,
- second: 0,
- year: 2010,
- },
- title: 'Bob Loblaw 3',
- },
],
}
integration › Temporal - temporal query argument, components
/home/robert/Development/neo4j-graphql-js/test/integration.js:949
948: .then(data => {
949: t.deepEqual(data.data, expected.data);
950: })
Difference:
{
OnlyDate: [
Object { … },
- {
- __typename: 'OnlyDate',
- date: {
- __typename: '_Neo4jDate',
- formatted: '2020-11-10',
- },
- },
],
}
integration › Temporal - temporal query argument, formatted
/home/robert/Development/neo4j-graphql-js/test/integration.js:986
985: .then(data => {
986: t.deepEqual(data.data, expected.data);
987: })
Difference:
{
OnlyDate: [
Object { … },
- {
- __typename: 'OnlyDate',
- date: {
- __typename: '_Neo4jDate',
- formatted: '2020-11-10',
- },
- },
],
}
integration › Query for temporal property on relationship
/home/robert/Development/neo4j-graphql-js/test/integration.js:1075
1074: .then(data => {
1075: t.deepEqual(data.data, expected.data);
1076: })
Difference:
{
Movie: [
{
__typename: 'Movie',
ratings: [
Object { … },
- {
- __typename: '_MovieRatings',
- date: {
- __typename: '_Neo4jDate',
- formatted: '2018-12-18',
- },
- rating: 5,
- },
],
title: 'Fire',
},
],
}
integration › Mutation with @cypher directive
/home/robert/Development/neo4j-graphql-js/test/integration.js:201
200: .catch(error => {
201: t.fail(error);
202: });
Error: GraphQL error: Node(32374) already exists with label `Genre` and property `name` = 'Wildlife Documentary'
integration › Create node mutation
/home/robert/Development/neo4j-graphql-js/test/integration.js:246
245: .catch(error => {
246: t.fail(error);
247: });
Error: GraphQL error: Node(32355) already exists with label `Movie` and property `movieId` = '12dd334d5zaaaa'
---------------------|----------|----------|----------|----------|-------------------|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
---------------------|----------|----------|----------|----------|-------------------|
All files | 94.87 | 83.12 | 94.99 | 95.05 | |
dist | 94.91 | 83.31 | 94.37 | 95.12 | |
augment.js | 95.58 | 84.78 | 95.92 | 95.94 |... 1008,1012,1242 |
auth.js | 82.76 | 64.15 | 85.71 | 81.82 |... 56,59,60,63,71 |
index.js | 65.65 | 39.34 | 53.85 | 66.15 |... 29,261,263,265 |
selections.js | 91.2 | 76.32 | 71.43 | 91.2 |... 40,141,143,144 |
translate.js | 99.19 | 92.15 | 100 | 99.18 |... 2002,2003,2004 |
utils.js | 93.4 | 82.18 | 95.04 | 93.96 |... 1039,1044,1045 |
dist/neo4j-schema | 94.48 | 80.37 | 97.12 | 94.48 | |
Neo4jSchemaTree.js | 98.11 | 81.25 | 97.73 | 98.11 | 155,224 |
entities.js | 96.1 | 80 | 93.1 | 96.1 | 61,70,91 |
graphQLMapper.js | 89.81 | 72.97 | 100 | 89.81 |... 81,183,207,208 |
types.js | 94.29 | 88.24 | 100 | 94.29 | 101,107 |
---------------------|----------|----------|----------|----------|-------------------|
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] test-all: `nyc ava test/*.js test/neo4j-schema/*Test.js --verbose`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] test-all script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/robert/.npm/_logs/2019-05-22T12_53_31_755Z-debug.log
This is an obvious indicator for so-called non-atomic tests, tests that are not isolated. Running one test case may interfere with another unrelated test case. This is a problem because it deteriorates the quality of the tests, makes flaky behaviour likely and leads to less confidence in the test setup. Plus, it's a not reproducible test setup, it's simply annoying to re-create your database every time.
Solution
Ideal solution:
- Clean the database after each test run
- For every test case, you have to setup the relevant data e.g. in a
beforeblock
How could you e.g. test the behaviour of this library, say, on an empty database?
The less optimal solution for now might be to check-in a dump of the database currently in use and load the dump prior to each test case.
@roschaefer , isn't this very similar to a situation we had a couple of weeks before? don't remember exactly, but there was a setting of the database config to queue the requests serially vs. working multitasked?
Nope. You talking about jest's --runInBand option. Jest is not used as a test runnner in this project, instead it's ava.
Plus, the test expect the very same state in the database and it's a lot of data, see below :point_down: It might be a lot of work to refactor the tests to use factories (set up the required data for each test). Then you can do MATCH(n) DELETE DETACH n;. If would clean the data after each test run, then the database is empty, which is not what you want. Something like a rollback or a database transaction would be great, but I don't know how to achieve this in our setting.

Ideally, we can restructure these tests to use just a Cypher based fixture for setup, rather than dependency on loading a full database dump
https://github.com/neo4j-graphql/neo4j-graphql-js/issues/608