This file contains hidden or 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
| { | |
| "name" : "pdes-nodejs-hola-mundo", | |
| "version" : "0.0.1", | |
| "main": "server.js", | |
| "dependencies" : { | |
| "express" : "~3.x" | |
| } | |
| } |
This file contains hidden or 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
| fun main(args: Array<String>) { | |
| val i = 1 | |
| i.doSomething() // FINE | |
| val s = "string" | |
| s.doSomething() // FINE | |
| val col = linkedListOf(i, s) | |
| col forEach { it.doSomething() } // COMPILATION ERROR | |
| } |
This file contains hidden or 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
| class Board | |
| def initialize width, height | |
| @width = width | |
| @height = height | |
| end | |
| def find_neighboring x, y | |
| xrange = neighboring_area(x, @width) |
This file contains hidden or 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
| type Object { | |
| project: String | |
| id: Int! | |
| properties: JSON // kind of a mixed type | |
| } | |
| Mutation: { | |
| updateObject(input: UpdateObjectInput) : Object | |
| } |
This file contains hidden or 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
| describeGQL('GRAPHQL API - Objects()', ({ expectQueryResult }) => { | |
| beforeEach('setup objects in mongo', async () => { | |
| await Object.insertMany([ | |
| { project: 'game', id: 10, data: { name: 'Pato Bullrich' } } | |
| ]) | |
| }) | |
| it('objectUpdate() updates an Object', async () => { |
This file contains hidden or 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 { graphql } from 'graphql' | |
| import mongoose from 'mongoose' | |
| import { Mockgoose } from 'mockgoose' | |
| import '../../src/models/all' | |
| import { expect } from 'chai' | |
| import { compileSchemas } from '../../src/graphql/utils/compileSchema' | |
| const internalDescribeQL = (describeFn) => (title, body) => { | |
| describeFn(title, () => { |
This file contains hidden or 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 WebSocket from 'ws' | |
| import { SubscriptionClient } from 'subscriptions-transport-ws'; | |
| import ApolloClient from 'apollo-client' | |
| const GRAPHQL_ENDPOINT = 'ws://localhost:5000/subscriptions'; |
This file contains hidden or 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
| describeFn(title, () => { | |
| // context | |
| let schema | |
| let apollo // <<< gets sets in the before() | |
| let networkInterface // <<< same | |
| before(async () => { | |
| // .. old stuff here | |
| // start server | |
| await rtm.start() // << this depends on your server |
This file contains hidden or 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('objectUpdated receives an update from calling mutation updateObject() in the same project', async () => { | |
| // SUBSCRIBE and make a promise | |
| const subscriptionPromise = new Promise((resolve, reject) => { | |
| client().subscribe({ | |
| query: gql` | |
| subscription objectUpdated { | |
| objectUpdated(project: "game") { | |
| id | |
| property |
This file contains hidden or 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 { graphql } from 'graphql' | |
| import mongoose from 'mongoose' | |
| import { Mockgoose } from 'mockgoose' | |
| import rtm from '../../src/features/rtm' | |
| import '../../src/models/all' | |
| import { expect } from 'chai' | |
| import { compileSchemas } from '../../src/graphql/utils/compileSchema' | |
| // subscriptiosn | |
| import WebSocket from 'ws' |
OlderNewer