diff --git a/src/graphql.js b/src/graphql.js index 43cc36ab..60f16227 100644 --- a/src/graphql.js +++ b/src/graphql.js @@ -7,7 +7,7 @@ import dotprop from "dot-prop-immutable"; const lorem = new LoremIpsum(); -const primitiveTypes = ["ID", "String", "Float", "Integer", "Boolean", "Date", "Time", "DateTime", "JSON", "SmallInteger", "BigInteger", "Decimal", "Char", "Varchar", "DateTimeWithZone"] +const primitiveTypes = ["ID", "String", "Float", "Integer", "Boolean", "Date", "Time", "DateTime", "JSON"] const getDefType = (type, isArray, required) => { isArray = isArray ? true : type.kind === "ListType"; required = required ? true : type.kind === "NonNullType"; @@ -183,18 +183,6 @@ const generateRandomValue = (type) => { return "2017-11-13T03:15:45.108Z" case "JSON": return { foo: "bar" } - case "SmallInteger": - return 12 - case "BigInteger": - return 4323 - case "Decimal": - return 23.84 - case "Char": - return "F919mV2W1ifQy9wlNyYnoOoqUM1" - case "Varchar": - return "7mr8VjGnCCerZUyzC9YDCn8Oxku" - case "DateTimeWithZone": - return "2021-11-22T03:15:45.108" default: return type } @@ -218,18 +206,6 @@ const generateRandomValue = (type) => { return new Date().toISOString() case "JSON": return { foo: "bar" } - case "SmallInteger": - return Math.ceil(Math.random() * 100) - case "BigInteger": - return Math.ceil(Math.random() * 10000) - case "Decimal": - return Number((Math.random() * 100).toFixed(2)) - case "Char": - return generateId(6) - case "Varchar": - return generateId(6) - case "DateTimeWithZone": - return new Date().toISOString() default: return type } diff --git a/src/graphql.test.js b/src/graphql.test.js index 4dd0f4e8..849be911 100644 --- a/src/graphql.test.js +++ b/src/graphql.test.js @@ -25,12 +25,6 @@ describe("generateSchemaAST method", () => { f19: String @link(table: mytype4, from: id, to: somefield, field: goodfield) f20: mytype5 @link(table: mytype5, from: id, to: nicefield) f21: [mytype6]! @link(table: mytype6, from: id, to: goodfield) - f22: SmallInteger - f23: BigInteger - f24: Decimal - f25: Char - f26: Varchar - f27: DateTimeWithZone } ` const expectedSchemaAST = { @@ -330,84 +324,6 @@ describe("generateSchemaAST method", () => { hasCreatedAtDirective: false, hasUpdatedAtDirective: false, hasNestedFields: true - }, - { - name: "f22", - type: "SmallInteger", - isRequired: false, - isPrimary: false, - hasUniqueConstraint: false, - hasForeignConstraint: false, - isLink: false, - isArray: false, - hasCreatedAtDirective: false, - hasUpdatedAtDirective: false, - hasNestedFields: false - }, - { - name: "f23", - type: "BigInteger", - isRequired: false, - isPrimary: false, - hasUniqueConstraint: false, - hasForeignConstraint: false, - isLink: false, - isArray: false, - hasCreatedAtDirective: false, - hasUpdatedAtDirective: false, - hasNestedFields: false - }, - { - name: "f24", - type: "Decimal", - isRequired: false, - isPrimary: false, - hasUniqueConstraint: false, - hasForeignConstraint: false, - isLink: false, - isArray: false, - hasCreatedAtDirective: false, - hasUpdatedAtDirective: false, - hasNestedFields: false - }, - { - name: "f25", - type: "Char", - isRequired: false, - isPrimary: false, - hasUniqueConstraint: false, - hasForeignConstraint: false, - isLink: false, - isArray: false, - hasCreatedAtDirective: false, - hasUpdatedAtDirective: false, - hasNestedFields: false - }, - { - name: "f26", - type: "Varchar", - isRequired: false, - isPrimary: false, - hasUniqueConstraint: false, - hasForeignConstraint: false, - isLink: false, - isArray: false, - hasCreatedAtDirective: false, - hasUpdatedAtDirective: false, - hasNestedFields: false - }, - { - name: "f27", - type: "DateTimeWithZone", - isRequired: false, - isPrimary: false, - hasUniqueConstraint: false, - hasForeignConstraint: false, - isLink: false, - isArray: false, - hasCreatedAtDirective: false, - hasUpdatedAtDirective: false, - hasNestedFields: false } ] } @@ -549,30 +465,6 @@ describe("generateRandomFieldValues method", () => { { name: "k9", type: "JSON" - }, - { - name: "k10", - type: "SmallInteger" - }, - { - name: "k11", - type: "BigInteger" - }, - { - name: "k12", - type: "Decimal" - }, - { - name: "k13", - type: "Char" - }, - { - name: "k14", - type: "Varchar" - }, - { - name: "k15", - type: "DateTimeWithZone" } ] const result = { @@ -586,13 +478,7 @@ describe("generateRandomFieldValues method", () => { k8: "2017-11-13T03:15:45.108Z", k9: { foo: "bar" - }, - k10: 12, - k11: 4323, - k12: 23.84, - k13: "F919mV2W1ifQy9wlNyYnoOoqUM1", - k14: "7mr8VjGnCCerZUyzC9YDCn8Oxku", - k15: "2021-11-22T03:15:45.108" + } } expect(generateRandomFieldValues(fields)).toEqual(result) })