Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Conversation

@jelisejev
Copy link
Contributor

Fixes #232

test('jokes.byCategory should return a random joke', async () => {
const response = await client().query({
query: gql`
query Query {
Copy link
Contributor

Choose a reason for hiding this comment

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

please change the operation name to something more descriptive e.g. GeRandomJokesByCategory

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

tests/client.ts Outdated
global['fetch'] = fetch;

const httpLink = new HttpLink({
uri: `${process.env.E2E_TEST_URI}/${process.env.GRAPHQL_PATH}`,
Copy link
Contributor

Choose a reason for hiding this comment

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

pls change to E2E_TEST_URL to stay consistent with SELF_URL

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You mean to rename the variable to E2E_TEST_URL?

Copy link
Contributor

Choose a reason for hiding this comment

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

yes

{
"testRegex": ".*\\.test\\.(ts)$",
"roots": [
"tests"
Copy link
Contributor

Choose a reason for hiding this comment

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

change to e2e ?

Copy link
Contributor Author

@jelisejev jelisejev Apr 27, 2018

Choose a reason for hiding this comment

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

Changed both the folder name and the suffix.

package.json Outdated
"@types/koa": "2.0.45",
"@types/koa-router": "7.0.27",
"@types/nock": "9.1.3",
"apollo-cache-inmemory": "^1.1.12",
Copy link
Contributor

Choose a reason for hiding this comment

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

please use the exact versions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

src/env.ts Outdated
CORS: bool({ devDefault: true, default: false }),
LOG_LEVEL: str({ default: 'info' }),
LIVENESS_PATH: str({ default: 'healthz' }),
E2E_TEST_URI: str({ default: 'http://localhost:3001' }),
Copy link
Contributor

Choose a reason for hiding this comment

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

let's keep the app env and the e2e test env variable sets separate
please move this to a different module, e.g. jest/test-env.ts and add to the jest setup files

tests/client.ts Outdated

const httpLink = new HttpLink({
uri: `${process.env.E2E_TEST_URI}/${process.env.GRAPHQL_PATH}`,
credentials: 'include',
Copy link
Contributor

Choose a reason for hiding this comment

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

why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not needed and removed.

tests/client.ts Outdated
import { ApolloClient } from 'apollo-client';
import { HttpLink } from 'apollo-link-http';
import { InMemoryCache } from 'apollo-cache-inmemory';
import gql from 'graphql-tag';
Copy link
Contributor

Choose a reason for hiding this comment

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

if your intention for importing gql is to simply re-export, you can do that explicitly:
export {default as gql} from 'graphql-tag'
although I don't see a reason for not importing it in the test directly, what difference does it make?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've done it this way because I find it more convenient to import these two things from a single place when writing tests.

Copy link
Contributor

Choose a reason for hiding this comment

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

k

tests/client.ts Outdated
import gql from 'graphql-tag';
import fetch from 'node-fetch';

global['fetch'] = fetch;
Copy link
Contributor

Choose a reason for hiding this comment

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

both statements can be removed with just import 'isomorphic-fetch'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Wonderful! Fixed.

{
"testRegex": ".*\\.test\\.(ts)$",
"roots": [
"tests"
Copy link
Contributor

Choose a reason for hiding this comment

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

aslo add to include array in tsconfig.json

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What for?

Copy link
Contributor

Choose a reason for hiding this comment

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

otherwise IDE will not use our root tsconfig.json

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, done.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hm, this changed broke compilation. Not sure what the problem is.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok will take a look later

README.md Outdated

### Run e2e tests

Run the app or point E2E_TEST_URI to a remote instance you want to test against.
Copy link
Contributor

Choose a reason for hiding this comment

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

please change to E2E_TEST_URL

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@trioletas trioletas merged commit a73a684 into ctco:master May 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

2 participants