Skip to content

Commit cd5dee8

Browse files
author
Daniel Schmidt
committed
test: initial test implementation
1 parent 4ffad95 commit cd5dee8

File tree

7 files changed

+426
-19
lines changed

7 files changed

+426
-19
lines changed

README.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,25 @@ React Hook bindings for [reactive-graphql](https://github.com/mesosphere/reactiv
55
## Usage
66

77
```ts
8+
import gql from "graphql-tag";
89
import getReactiveGraphqlReact from "reactive-graphql-react";
910

1011
const schema = getSchema(); // get a GraphQL schema
11-
const queryGraphql = getReactiveGraphqlReact(schema); // get the hook
12+
const useGraphql = getReactiveGraphqlReact(schema); // get the hook
1213

1314
export default function MyComponent() {
1415
// Always up-to-date data
15-
const [result, error] = queryGraphql(`
16-
query {
17-
posts {
18-
title
19-
author {
20-
name
21-
}
22-
}
16+
const [result, error] = useGraphql(gql`
17+
query {
18+
posts {
19+
title
20+
author {
21+
name
2322
}
24-
`);
23+
}
24+
}
25+
`);
26+
2527
if (error) {
2628
return <h3>There has been an error fetching the data</h3>;
2729
}

package-lock.json

Lines changed: 120 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,20 @@
3535
"devDependencies": {
3636
"@types/jest": "^23.3.12",
3737
"graphql-tag": "^2.10.1",
38+
"graphql-tools": "^4.0.4",
3839
"jest": "^23.6.0",
40+
"jest-react": "^0.6.4",
41+
"prettier": "^1.16.4",
3942
"react": "16.8.0-alpha.1",
43+
"react-test-renderer": "^16.8.4",
4044
"react-testing-library": "^5.4.4",
4145
"semantic-release": "^15.13.3",
4246
"travis-deploy-once": "^5.0.11",
4347
"ts-jest": "^23.10.5",
4448
"typescript": "^3.2.4"
4549
},
4650
"peerDependencies": {
47-
"react": ">= 16.8.0-alpha.1"
51+
"react": ">= 16.8.0"
4852
},
4953
"dependencies": {
5054
"reactive-graphql": "^2.0.0",

src/__tests__/index-test.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)