UNPKG

@userlab/dx

Version:

Build efficient GraphQL backend

48 lines (47 loc) 1.54 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var graphql_1 = require("graphql"); var setExtension_1 = require("../setExtension"); describe('setExtension', function () { it('set sqlColumn', function () { var fields = { id: { type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLID) }, name: { type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLString) }, isDisabled: { type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLBoolean), sqlColumn: 'is_disabled', }, }; var result = setExtension_1.setExtension(fields); var resultJson = JSON.parse(JSON.stringify(result)); expect(resultJson).toEqual({ id: { type: 'ID!', sqlColumn: 'id', extensions: { joinMonster: { sqlColumn: 'id', }, }, }, name: { type: 'String!', sqlColumn: 'name', extensions: { joinMonster: { sqlColumn: 'name', }, }, }, isDisabled: { type: 'Boolean!', sqlColumn: 'is_disabled', extensions: { joinMonster: { sqlColumn: 'is_disabled', }, }, }, }); }); });