UNPKG

chimp

Version:

Your development companion for doing quality, faster.

77 lines (67 loc) 1.6 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const getScalars_1 = tslib_1.__importDefault(require("./getScalars")); const gql = (a) => a[0]; test('get the non extended types with apollo key annotation', () => { const schemaString = gql ` type TodoItem @key(fields: "id") { id: ID! list: List } extend type List { id: ID! todos: [TodoItem!]! incompleteCount: Int! } type InMemory { id: ID! } scalar MyOwn `; const res = (0, getScalars_1.default)(schemaString); expect(res).toEqual(['MyOwn']); }); test('ignore built-in Upload scalar', () => { const schemaString = gql ` type TodoItem @key(fields: "id") { id: ID! list: List } extend type List { id: ID! todos: [TodoItem!]! incompleteCount: Int! } type InMemory { id: ID! } scalar First scalar Upload scalar ThirdOne `; const res = (0, getScalars_1.default)(schemaString); expect(res).toEqual(['First', 'ThirdOne']); }); test('ignore predefined scalars', () => { const schemaString = gql ` type TodoItem @key(fields: "id") { id: ID! list: List } extend type List { id: ID! todos: [TodoItem!]! incompleteCount: Int! } type InMemory { id: ID! } scalar First scalar Predefined @predefined scalar Upload scalar ThirdOne `; const res = (0, getScalars_1.default)(schemaString); expect(res).toEqual(['First', 'ThirdOne']); });