-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Graphql tests #237
Added Graphql tests #237
Conversation
@prasadtalasila Here are the two Graphql tests with Apollo 😃 |
servers/lib/test/e2e/app.e2e.spec.ts
Outdated
@@ -41,14 +47,29 @@ describe("End to End test for the application", () => { | |||
expect(response.body).toEqual(expectedListDirectoryResponse); | |||
}, 10000); | |||
|
|||
it("should return the content of a file given in the query ", async () => { | |||
it("should return the filename corresponding to the directory given in the query |GraphQL|", async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 2 locations. Consider refactoring.
servers/lib/test/e2e/app.e2e.spec.ts
Outdated
const query = e2eReadFile; | ||
|
||
const response = await request("http://localhost:4001") | ||
.post(process.env.APOLLO_PATH) | ||
.send({ query }); | ||
expect(response.body).toEqual(expectedFileContentResponse); | ||
}, 10000); | ||
|
||
it("should return the content of a file given in the query |GraphQL|", async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 2 locations. Consider refactoring.
Codecov Report
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. @@ Coverage Diff @@
## feature/distributed-demo #237 +/- ##
=============================================================
- Coverage 93.02% 58.95% -34.07%
=============================================================
Files 4 8 +4
Lines 43 134 +91
Branches 3 7 +4
=============================================================
+ Hits 40 79 +39
- Misses 0 49 +49
- Partials 3 6 +3 see 12 files with indirect coverage changes
|
servers/lib/test/e2e/app.e2e.spec.ts
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the following:
- import of child_process
- execSync("test/starttraefik.bash");
- execSync("test/stoptraefik.bash");
The suggested names for the tests:
- Should return the directory contents requested with HTTP POST query
- Should return the filecontent requested with HTTP POST query
- Should return the directory contents requested with GraphQL query
- Should return the filecontent requested with GraphQL query
A quick question: how are the environment variables supplied to this test?
servers/lib/test/e2e/app.e2e.spec.ts
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When yarn test -e
is run, the tests fail with the following log:
$ script/test.bash -e
README.md file created with 'content123'
FAIL test/e2e/app.e2e.spec.ts
● Test suite failed to run
Cannot find module 'react' from '../node_modules/@apollo/client/react/context/context.cjs'
Require stack:
/home/prasad/git/prasadtalasila/DTaaS/servers/lib/node_modules/@apollo/client/react/context/context.cjs
/home/prasad/git/prasadtalasila/DTaaS/servers/lib/node_modules/@apollo/client/react/react.cjs
/home/prasad/git/prasadtalasila/DTaaS/servers/lib/node_modules/@apollo/client/main.cjs
e2e/app.e2e.spec.ts
10 | expectedListDirectoryResponse,
11 | } from "../testUtil";
> 12 | import { ApolloClient, InMemoryCache, gql } from "@apollo/client";
| ^
13 |
14 | const client = new ApolloClient({
15 | uri: `http://localhost:4001${process.env.APOLLO_PATH}`,
at Resolver._throwModNotFoundError (../node_modules/jest-resolve/build/resolver.js:427:11)
at Object.<anonymous> (../node_modules/@apollo/client/react/context/context.cjs:6:13)
at Object.<anonymous> (../node_modules/@apollo/client/react/react.cjs:6:15)
at Object.<anonymous> (../node_modules/@apollo/client/main.cjs:6:13)
at Object.<anonymous> (e2e/app.e2e.spec.ts:12:1)
Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 2.552 s
@OliverGeneser please check the comments |
@OliverGeneser Further changes:
|
servers/lib/test/e2e/app.e2e.spec.ts
Outdated
@@ -41,14 +44,29 @@ describe("End to End test for the application", () => { | |||
expect(response.body).toEqual(expectedListDirectoryResponse); | |||
}, 10000); | |||
|
|||
it("should return the content of a file given in the query ", async () => { | |||
it("should return the directory contents requested with GraphQL query", async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 2 locations. Consider refactoring.
servers/lib/test/e2e/app.e2e.spec.ts
Outdated
const query = e2eReadFile; | ||
|
||
const response = await request("http://localhost:4001") | ||
.post(process.env.APOLLO_PATH) | ||
.send({ query }); | ||
expect(response.body).toEqual(expectedFileContentResponse); | ||
}, 10000); | ||
|
||
it("should return the filecontent requested with GraphQL query", async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 2 locations. Consider refactoring.
servers/lib/test/e2e/app.e2e.spec.ts
Outdated
await app.close(); | ||
}, 10000); | ||
|
||
it("should return the filename corresponding to the directory given in the query", async () => { | ||
it("should return the directory contents requested with HTTP POST query", async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 2 locations. Consider refactoring.
servers/lib/test/e2e/app.e2e.spec.ts
Outdated
expect({data}).toEqual(expectedListDirectoryResponse); | ||
}, 10000); | ||
|
||
it("should return the filecontent requested with HTTP POST query", async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 2 locations. Consider refactoring.
Code Climate has analyzed commit 73a91ed and detected 4 issues on this pull request. Here's the issue category breakdown:
View more on Code Climate. |
73a91ed
to
0631410
Compare
No description provided.