UNPKG

wgc

Version:

The official CLI tool to manage the GraphQL Federation Platform Cosmo

32 lines 1.23 kB
import { describe, test } from 'vitest'; import { Command } from 'commander'; import { createClient, createRouterTransport } from '@connectrpc/connect'; import { PlatformService } from '@wundergraph/cosmo-connect/dist/platform/v1/platform_pb'; import { EnumStatusCode } from '@wundergraph/cosmo-connect/dist/common/common_pb'; import CheckFederatedGraph from '../src/commands/graph/federated-graph/commands/check.js'; export const mockPlatformTransport = () => createRouterTransport(({ service }) => { service(PlatformService, { checkFederatedGraph: (ctx) => { return { response: { code: EnumStatusCode.OK, }, }; }, }); }); describe('Schema Command', () => { test('Check federated graph', () => { const client = { platform: createClient(PlatformService, mockPlatformTransport()), }; const program = new Command(); program.addCommand(CheckFederatedGraph({ client, })); const command = program.parse(['check', 'wg.orders', '--label-matcher', 'team=A'], { from: 'user', }); }); }); //# sourceMappingURL=check-federated-graph.test.js.map