This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { InputHTMLAttributes, useMemo, forwardRef } from 'react'; | |
import ReactInputMask from 'react-input-mask'; | |
import styles from './index.module.css'; | |
type FloatingLabelInputProps = InputHTMLAttributes<HTMLInputElement> & { | |
label: string; | |
mask?: string; | |
className?: string; | |
errorMessage?: string; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// TO VIEW THE WORK DONE ON LOADING EN EXPERIMENTAL CONFIG, SEE THIS BRANCH: | |
// https://github.com/apollographql/apollo-tooling/compare/jake/experimental-config | |
/** | |
* Goal: rebuild apollo config to allow for easier configuration | |
* | |
* Ideas: | |
* - More top-level options with fewer nested keys | |
* - I don't think field nesting is strictly necessary, since a _lot_ | |
* of things are duplicated between client/service projects (like includes) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { HttpLink } from 'apollo-link-http'; | |
import * as express from 'express'; | |
import fetch from 'node-fetch'; | |
import { AddressInfo } from 'net'; | |
import { execute } from 'apollo-link'; | |
export { toPromise } from 'apollo-link'; | |
import { ApolloServer } from './'; | |
export const startTestServer = async (server: ApolloServer) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { | |
graphql, | |
GraphQLEnumType, | |
GraphQLType, | |
GraphQLSchema, | |
GraphQLObjectType, | |
GraphQLBoolean, | |
} = require('graphql'); | |
const { gql } = require('graphql-tag'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it('should delete and give visual feedback', async () => { | |
const deleteDog = { name: 'Buck', breed: 'Poodle', id: 1 }; | |
const mocks = [ | |
{ | |
request: { | |
query: DELETE_DOG_MUTATION, | |
variables: { name: 'Buck' }, | |
}, | |
result: { data: { deleteDog } }, | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it('should render loading state initially', () => { | |
const deleteDog = { name: 'Buck', breed: 'Poodle', id: 1 }; | |
const mocks = [ | |
{ | |
request: { | |
query: DELETE_DOG_MUTATION, | |
variables: { name: 'Buck' }, | |
}, | |
result: { data: { deleteDog } }, | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import DeleteButton, { DELETE_DOG_MUTATION } from './delete-dog'; | |
it('should render without error', () => { | |
renderer.create( | |
<MockedProvider mocks={[]}> | |
<DeleteButton /> | |
</MockedProvider>, | |
); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const DELETE_DOG_MUTATION = gql` | |
mutation deleteDog($name: String!) { | |
deleteDog(name: $name) { | |
id | |
name | |
breed | |
} | |
} | |
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it('should show error UI', async () => { | |
const dogMock = { | |
request: { | |
query: GET_DOG_QUERY, | |
variables: { name: 'Buck' }, | |
}, | |
error: new Error('aw shucks'), | |
}; | |
const component = renderer.create( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const wait = require('waait'); | |
it('should render dog', async () => { | |
const dogMock = { | |
request: { | |
query: GET_DOG_QUERY, | |
variables: { name: 'Buck' }, | |
}, | |
result: { | |
data: { dog: { id: 1, name: 'Buck', breed: 'poodle' } }, |
NewerOlder