moleculer-api
Version:
A dynamic API Gateway for MoleculerJS which updates REST endpoints and aggregated GraphQL schema, access control policy for each action calls from metadata of remote services schema without restart or deployment.
78 lines • 2.3 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const test_1 = require("../../../../test");
const plugin_1 = require("./plugin");
describe("GraphQL schema validation test", () => {
const plugin = new plugin_1.GraphQLProtocolPlugin({
logger: test_1.getLogger(),
policyPlugins: [],
});
it("valid schema should be return true", () => {
return expect(plugin.validateSchema({
description: "..",
typeDefs: `
type Player implements xx {
name: String
}
type Query {
viewer: Number
}
type Mutation implements abcd & efgh {
test: String
}
extend type Mutation implements test {
test: Number
}
interface test {
name: String!
}
extend interface test {
phone: Number
}
type Hello {
a: String!
}
`,
resolvers: {
Player: {
// @ts-ignore
__isTypeOf: "",
// @ts-ignore
name: {
call: {
action: "test",
params: {},
},
},
},
// @ts-ignore
Query: {
viewer: {
call: {
action: "upload",
params: {
stream: "@.body.file",
meta: {
filename: "@.body.name",
},
},
map: "() => { return 1; }",
},
ignoreError: true,
},
},
Mutation: {
test: {
call: {
action: "test",
params: {},
},
},
// @ts-ignore
__isTypeOf: "() => true",
},
},
})).toMatchObject([]);
});
});
//# sourceMappingURL=plugin.spec.js.map