Skip to content

Commit

Permalink
adding basic test for adding feeds
Browse files Browse the repository at this point in the history
  • Loading branch information
Charlie ⚡ committed Sep 5, 2022
1 parent 8a0a449 commit 36279cc
Showing 1 changed file with 48 additions and 3 deletions.
51 changes: 48 additions & 3 deletions test/integration.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,52 @@
import { resolver } from "../server/resolvers";
/**
* @jest-environment node
*/

import { createServer } from "@graphql-yoga/common";
import { schema } from "../server/schema";
import { context } from "../server/context";
import gql from "graphql-tag";

const yoga = createServer({
schema: schema,
context: () => context,
});

describe("Integration", () => {
xit("has resolvers", () => {
console.log(resolver);
it("can create feeds", async () => {
const createFeed = await yoga.inject({
document: gql`
mutation CreateFeed($url: String!) {
addFeed(url: $url) {
id
title
}
}
`,
variables: {
url: "https://www.inputmag.com/rss",
},
});

expect(createFeed.executionResult?.data.addFeed.title).toEqual("Input");

const entryList = await yoga.inject({
document: gql`
query EntriesByFeed($id: ID!) {
entries(feed_id: $id) {
title
content
id
unread
published
}
}
`,
variables: {
id: createFeed.executionResult?.data.addFeed.id,
},
});

expect(entryList.executionResult?.data.entries.length).toBeGreaterThan(1);
});
});

1 comment on commit 36279cc

@vercel
Copy link

@vercel vercel bot commented on 36279cc Sep 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.