Skip to content

Commit

Permalink
fixed few issues:
Browse files Browse the repository at this point in the history
  • Loading branch information
cdmbase committed Aug 26, 2017
1 parent 3fc1cb6 commit 4ff1df5
Show file tree
Hide file tree
Showing 7 changed files with 3,296 additions and 57 deletions.
3,273 changes: 3,273 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
"test": "jest",
"test:debug": "npm test -- --runInBand",
"test:watch": "npm test -- --watch",
"compile": "tsc",
"build": "tsc",
"build:debug": "tsc --pretty",
"build:prod": "tsc",
"watch": "tsc -w"
},
"repository": {
Expand Down Expand Up @@ -57,4 +59,4 @@
"tslint": "^5.2.0",
"typescript": "2.3.4"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
GraphQLObjectType,
GraphQLString,
} from 'graphql';
import { withFilter } from '../with-filter';
import { withFilter } from 'graphql-subscriptions';
import { subscribe } from 'graphql/subscription';
import { logger } from './logger';

Expand Down Expand Up @@ -50,10 +50,11 @@ describe('GraphQL-JS asyncIterator', () => {
testSubscription
}
`);
const pubsub = new NatsPubSub({logger});
const pubsub = new NatsPubSub({ logger });
const origIterator = pubsub.asyncIterator(FIRST_EVENT);
const schema = buildSchema(origIterator);
const orig2Iterator = pubsub.asyncIterator('TEST123');

const schema = buildSchema(origIterator);
const results = subscribe(schema, query);
const payload1 = results.next();

Expand All @@ -63,7 +64,7 @@ describe('GraphQL-JS asyncIterator', () => {
expect(res.value.data.testSubscription).toEqual('FIRST_EVENT');
});

pubsub.publish(FIRST_EVENT, {});
pubsub.publish(FIRST_EVENT, { test: { file: true } });

return r;
});
Expand All @@ -75,7 +76,7 @@ describe('GraphQL-JS asyncIterator', () => {
}
`);

const pubsub = new NatsPubSub({logger});
const pubsub = new NatsPubSub({ logger });
const origIterator = pubsub.asyncIterator(FIRST_EVENT);

let counter = 0;
Expand Down Expand Up @@ -113,7 +114,7 @@ describe('GraphQL-JS asyncIterator', () => {
}
`);

const pubsub = new NatsPubSub({logger});
const pubsub = new NatsPubSub({ logger });
const origIterator = pubsub.asyncIterator(FIRST_EVENT);
const returnSpy = jest.spyOn(origIterator, 'return');
const schema = buildSchema(origIterator);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,15 @@ describe('AsyncIterator', () => {

iterator.next().then(result => {
customLogger.trace('result: (%j)', result);
expect(result).toBeDefined();
expect(result.value).toBeDefined();
expect(result.done).toBeDefined();
done();
try {
expect(result).toBeDefined();
expect(result.value).toBeDefined();
expect(result.done).toBeDefined();
done();
} catch (e) {
done.fail(e);
}

});
ps.publish(eventName, { test: true });
});
Expand Down
1 change: 0 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export { NatsPubSub } from './nats-pubsub';
export { withFilter, ResolverFn, FilterFn } from './with-filter';
42 changes: 0 additions & 42 deletions src/with-filter.ts

This file was deleted.

5 changes: 3 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "es5",
"target": "es6",
"module": "commonjs",
"experimentalDecorators": true,
"declaration": true,
Expand All @@ -9,7 +9,8 @@
"noLib": false,
"preserveConstEnums": false,
"moduleResolution": "node",
"sourceMap": true,
// "sourceMap": true,
"inlineSourceMap": true,
"rootDir": "./src",
"outDir": "./dist",
"allowSyntheticDefaultImports": true,
Expand Down

0 comments on commit 4ff1df5

Please sign in to comment.