Replaced tests with jest

This commit is contained in:
2022-02-20 20:10:08 +00:00
parent f2994fc52e
commit ca11cc8963
23 changed files with 7595 additions and 1019 deletions

View File

@@ -1,5 +1,5 @@
//build the tokens into a single object of types representing the initial query
const parseCreateTree = (tokens, typeGraph, options) => {
const parseCreateTree = (tokens, typeGraph, options = {}) => {
let current = 1; //primed
//check this is a create command
@@ -94,6 +94,9 @@ const readBlock = (tokens, current, superType, typeGraph, options) => {
//insert the typename into the block
block['typeName'] = typeGraph[superType][fieldName].typeName;
//insert the unique modifier if it's set
block['unique'] = typeGraph[superType][fieldName].unique;
//insert the block-level modifier signal
if (modifier) {
block[modifier] = true;
@@ -122,6 +125,9 @@ const readBlock = (tokens, current, superType, typeGraph, options) => {
//save the typeGraph type into result
result[fieldName] = JSON.parse(JSON.stringify( typeGraph[ typeGraph[superType][fieldName].typeName ] ));
//insert the unique modifier if it's set
result[fieldName]['unique'] = typeGraph[superType][fieldName].unique;
//insert the block-level modifier signal
if (modifier) {
result[fieldName][modifier] = tokens[current++];