I hereby claim:
- I am barsumek on github.
- I am barsum (https://keybase.io/barsum) on keybase.
- I have a public key ASBxbJzNQwbpUuw3zvtO0rhfZHGky2ULhInHslnKa3DhOQo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
query IntrospectionQuery { | |
__schema { | |
queryType { | |
name | |
} | |
mutationType { | |
name | |
} | |
types { | |
...FullType |
const defaultString = { | |
String: () => "John Doe" | |
}; | |
/* eslint-env detox/detox, mocha */ | |
const { defaultPokemon, maxLvlPokemon } = require("../graphql/mocks/pokemon"); | |
const { date } = require("../graphql/mocks/scalars"); | |
const { | |
startGraphQLServer, | |
stopGraphQLServer | |
} = require("../graphql/mockedGraphQLServer"); | |
describe("Test Pokemon screen", () => { | |
beforeEach(async () => { |
const { startGraphQLServer } = require("./mockedGraphQLServer"); | |
const { defaultPokemon } = require("./mocks/pokemon"); | |
const { defaultTrainer } = require("./mocks/trainer"); | |
const { date, defaultString } = require("./mocks/scalars"); | |
const customMocks = { | |
...date, | |
...defaultString, | |
...defaultPokemon, | |
...defaultTrainer |
const { GraphQLScalarType } = require("graphql"); | |
const { Kind } = require("graphql/language"); | |
const date = { | |
Date: () => new Date() | |
}; | |
// for custom scalar types such as Date you need to write resolvers | |
// then add them to ApolloServer config in startGraphQLServer | |
const resolvers = { |
const defaultString = { | |
String: () => "John Doe" | |
}; | |
// Test non-max Pokemon level | |
{ | |
const defaultPokemon = { | |
Pokemon: () => ({ | |
level: 10 | |
}) | |
}; | |
//... | |
await startGraphQLServer({ ...defaultPokemon }); | |
} |
function stopHttpServer() { | |
return new Promise(resolve => httpServer.close(() => resolve())); | |
} | |
async function stopGraphQLServer() { | |
if (!httpServer) { | |
console.warn("Tried to close null HTTP server."); | |
return; | |
} |
const express = require("express"); | |
const PORT = 8089; | |
let graphQLServerApp; | |
let httpServer; | |
function startHttpServer() { | |
return new Promise(resolve => { | |
httpServer = graphQLServerApp.listen(PORT, () => { |