UNPKG

wgc

Version:

The official CLI tool to manage the GraphQL Federation Platform Cosmo

32 lines 1.26 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 CreateSubgraphCommand from '../src/commands/subgraph/commands/create.js'; export const mockPlatformTransport = () => createRouterTransport(({ service }) => { service(PlatformService, { createFederatedSubgraph: (ctx) => { return { response: { code: EnumStatusCode.OK, }, }; }, }); }); describe('Schema Command', () => { test('Create subgraph', () => { const client = { platform: createClient(PlatformService, mockPlatformTransport()), }; const program = new Command(); program.addCommand(CreateSubgraphCommand({ client, })); const command = program.parse(['create', 'wg.orders', '--routing-url', 'http://localhost:4000/graphql', '--label', 'user'], { from: 'user', }); }); }); //# sourceMappingURL=create-subgraph.test.js.map