Working on test framework

This commit is contained in:
2021-03-30 09:07:02 +11:00
parent 9f4b869d84
commit f4dd51ac31
4 changed files with 129 additions and 13 deletions

View File

@@ -7,10 +7,10 @@ const parseInput = require('./parse-input');
const buildTypeGraph = (schema, options) => {
//the default graph
let graph = {
String: { scalar: true },
Integer: { scalar: true },
Float: { scalar: true },
Boolean: { scalar: true },
String: { typeName: 'String', scalar: true },
Integer: { typeName: 'Integer', scalar: true },
Float: { typeName: 'Float', scalar: true },
Boolean: { typeName: 'Boolean', scalar: true },
};
//parse the schema
@@ -35,7 +35,7 @@ const buildTypeGraph = (schema, options) => {
throw 'Unexpected keyword ' + tokens[pos];
}
graph[tokens[pos++]] = { scalar: true };
graph[tokens[pos++]] = { typeName: tokens[pos - 1], scalar: true };
if (options.debug) {
console.log(`Defined ${tokens[pos - 1]}:\n`, graph[tokens[pos - 1]]);
@@ -63,7 +63,7 @@ const parseCompoundType = (tokens, pos, scalars, options) => {
}
//graph component to be returned
const compound = {};
const compound = { typeName: tokens[pos - 1] };
//for each line of the compound type
while (tokens[pos++] && tokens[pos] !== '}') {

View File

@@ -1 +1 @@
["type", "scalar", "create", "update", "delete", "set", "match"]
["type", "scalar", "create", "update", "delete", "set", "match", "typeName"]