Skip to content

Instantly share code, notes, and snippets.

View jaroslav-kubicek's full-sized avatar

Jaroslav Kubíček jaroslav-kubicek

View GitHub Profile
@jaroslav-kubicek
jaroslav-kubicek / keybase.md
Created September 4, 2017 09:14
Keybase stuff

Keybase proof

I hereby claim:

  • I am jaroslav-kubicek on github.
  • I am kubajz (https://keybase.io/kubajz) on keybase.
  • I have a public key ASDXOWgEHdfV9ZSIkhsm82dRQq57hpBuAxdUw1LFt0CQyAo

To claim this, I am signing this object:

@jaroslav-kubicek
jaroslav-kubicek / findFlights_schema_01.js
Last active May 14, 2018 21:43
Sample schema for "Implementing GraphQL server" article
// @flow
import {
GraphQLObjectType,
GraphQLList,
GraphQLString,
GraphQLInt,
GraphQLNonNull,
GraphQLSchema,
} from 'graphql';
@jaroslav-kubicek
jaroslav-kubicek / response.json
Created July 26, 2018 07:56
Original output for "bags" list
{
"node": {
"outbound": {
"departure": {
"cityId": "prague_cz",
"localTime": "2018-06-30T17:30:00.000Z"
}
},
"allowedBaggage": {
"cabin": [

Keybase proof

I hereby claim:

  • I am jaroslav-kubicek on github.
  • I am kubajz (https://keybase.io/kubajz) on keybase.
  • I have a public key ASAjeFyASDvCCG5hc_OWLNVagezGhhiDQqK_uCrvGxYvRgo

To claim this, I am signing this object:

{
"additional_bookings": {
"details": []
},
"arrival": {
"when": 0,
"where": {
"code": "VKO",
"name": "Moscow"
}
@jaroslav-kubicek
jaroslav-kubicek / cypress_mockGraphQL.js
Last active September 11, 2019 09:08
Snippet how to mock GraphQL request in cypress
// --------------------------------------
// Mock GraphQL requests with stubs.
// Inspiration: https://github.com/cypress-io/cypress-documentation/issues/122
// --------------------------------------
Cypress.Commands.add('visitWithMockedGraphQL', (page, stubs) => {
cy.visit(page, {
onBeforeLoad: win => {
cy.stub(win, 'fetch', handleFetch(stubs));
},
});
module.exports = {
entry: {
main: './src/app.js',
},
output: {
// `filename` provides a template for naming your bundles (remember to use `[name]` or `[contenthash]`)
filename: '[name].bundle.js',
// `chunkFilename` provides a template for naming code-split bundles (optional)
chunkFilename: '[name].bundle.js',
// `path` is the folder where Webpack will place your bundles
// @flow
import * as React from 'react';
import { createFragmentContainer, graphql } from 'react-relay';
import { ThemeContext } from 'styled-components';
import { withRouter } from 'react-router-dom';
import {
Ticket,
Airplane,
InformationCircle,
// @flow
import * as React from 'react';
import { mount } from 'enzyme';
import { QueryRenderer, graphql } from '@adeira/relay';
import { createMockEnvironment, MockPayloadGenerator } from 'relay-test-utils';
describe('Component', () => {
it('Shows something', () => {
const environment = createMockEnvironment();
/* @flow */
// uncomment this comment :) // flowlint unclear-type:error
// SEE https://flow.org/en/docs/linting/rule-reference/#toc-unclear-type
// "any" type - not very helpful
const foo: any = 42;
foo.bar.baz