diff --git a/e2e/json-schema-reddit/__snapshots__/json-schema-reddit.test.ts.snap b/e2e/json-schema-reddit/__snapshots__/json-schema-reddit.test.ts.snap deleted file mode 100644 index 56e35e1341307..0000000000000 --- a/e2e/json-schema-reddit/__snapshots__/json-schema-reddit.test.ts.snap +++ /dev/null @@ -1,16 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should execute Subredit 1`] = ` -{ - "data": { - "subreddit": { - "data": { - "dist": 26, - "geo_filter": null, - "modhash": "", - }, - "kind": "Listing", - }, - }, -} -`; diff --git a/e2e/json-schema-reddit/json-schema-reddit.test.ts b/e2e/json-schema-reddit/json-schema-reddit.test.ts deleted file mode 100644 index 7ac72874920af..0000000000000 --- a/e2e/json-schema-reddit/json-schema-reddit.test.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { createTenv } from '@e2e/tenv'; - -const { compose, serve } = createTenv(__dirname); - -it('should compose the appropriate schema', async () => { - const { result } = await compose(); - - // TODO: we cant match snapshot because the schema is not stable - expect(result).toContain( - `type query_subreddit_data @source(subgraph: "Reddit", name: "query_subreddit_data")`, - ); -}); - -it.concurrent.each([ - { - name: 'Subredit', - query: /* GraphQL */ ` - query Subredit { - subreddit(subreddit: "graphql") { - kind - data { - dist - modhash - geo_filter - } - } - } - `, - }, -])('should execute $name', async ({ query }) => { - const { target } = await compose({ target: 'graphql' }); - const { execute } = await serve({ fusiongraph: target }); - await expect(execute({ query })).resolves.toMatchSnapshot(); -}); diff --git a/examples/v1-next/json-schema-reddit/.gitignore b/examples/v1-next/json-schema-reddit/.gitignore new file mode 100644 index 0000000000000..14535c6c2411b --- /dev/null +++ b/examples/v1-next/json-schema-reddit/.gitignore @@ -0,0 +1 @@ +fusiongraph.graphql diff --git a/examples/v1-next/json-schema-reddit/README.md b/examples/v1-next/json-schema-reddit/README.md deleted file mode 100644 index 182b826ea444a..0000000000000 --- a/examples/v1-next/json-schema-reddit/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# This example is [e2e](/e2e) tested - -[🔗 Go to example.](/e2e/json-schema-reddit) diff --git a/e2e/json-schema-reddit/mesh.config.ts b/examples/v1-next/json-schema-reddit/mesh.config.ts similarity index 87% rename from e2e/json-schema-reddit/mesh.config.ts rename to examples/v1-next/json-schema-reddit/mesh.config.ts index 7a6aed3ccc448..4e0e9cb56cac4 100644 --- a/e2e/json-schema-reddit/mesh.config.ts +++ b/examples/v1-next/json-schema-reddit/mesh.config.ts @@ -1,13 +1,10 @@ import { OperationTypeNode } from 'graphql'; -import { Args } from '@e2e/args'; import { defineConfig as defineComposeConfig } from '@graphql-mesh/compose-cli'; import { defineConfig as defineServeConfig } from '@graphql-mesh/serve-cli'; import { loadJSONSchemaSubgraph } from '@omnigraph/json-schema'; -const args = Args(process.argv); - export const composeConfig = defineComposeConfig({ - target: args.get('target'), + target: 'fusiongraph.graphql', subgraphs: [ { sourceHandler: loadJSONSchemaSubgraph('Reddit', { @@ -39,6 +36,5 @@ export const composeConfig = defineComposeConfig({ }); export const serveConfig = defineServeConfig({ - port: args.getPort(), - fusiongraph: args.get('fusiongraph'), + fusiongraph: 'fusiongraph.graphql', }); diff --git a/e2e/json-schema-reddit/package.json b/examples/v1-next/json-schema-reddit/package.json similarity index 62% rename from e2e/json-schema-reddit/package.json rename to examples/v1-next/json-schema-reddit/package.json index fcda99f2e2b0a..46648483fb4c6 100644 --- a/e2e/json-schema-reddit/package.json +++ b/examples/v1-next/json-schema-reddit/package.json @@ -1,6 +1,10 @@ { - "name": "@e2e/reddit-example", + "name": "@examples/reddit-example", "private": true, + "scripts": { + "compose": "yarn mesh-compose", + "serve": "yarn mesh-serve" + }, "dependencies": { "@graphql-mesh/compose-cli": "workspace:*", "@graphql-mesh/serve-cli": "workspace:*", diff --git a/yarn.lock b/yarn.lock index 7b3af67727edc..b63a7e74781c9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3743,17 +3743,6 @@ __metadata: languageName: unknown linkType: soft -"@e2e/reddit-example@workspace:e2e/json-schema-reddit": - version: 0.0.0-use.local - resolution: "@e2e/reddit-example@workspace:e2e/json-schema-reddit" - dependencies: - "@graphql-mesh/compose-cli": "workspace:*" - "@graphql-mesh/serve-cli": "workspace:*" - "@omnigraph/json-schema": "workspace:*" - graphql: "npm:16.8.1" - languageName: unknown - linkType: soft - "@e2e/soap-demo@workspace:e2e/soap-demo": version: 0.0.0-use.local resolution: "@e2e/soap-demo@workspace:e2e/soap-demo" @@ -4239,6 +4228,17 @@ __metadata: languageName: node linkType: hard +"@examples/reddit-example@workspace:examples/v1-next/json-schema-reddit": + version: 0.0.0-use.local + resolution: "@examples/reddit-example@workspace:examples/v1-next/json-schema-reddit" + dependencies: + "@graphql-mesh/compose-cli": "workspace:*" + "@graphql-mesh/serve-cli": "workspace:*" + "@omnigraph/json-schema": "workspace:*" + graphql: "npm:16.8.1" + languageName: unknown + linkType: soft + "@fastify/ajv-compiler@npm:^3.5.0": version: 3.5.0 resolution: "@fastify/ajv-compiler@npm:3.5.0"