graphql-subscriptions
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -120,2 +120,3 @@ "use strict"; | ||
}); | ||
delete this.subscriptions[subId]; | ||
}; | ||
@@ -122,0 +123,0 @@ return SubscriptionManager; |
@@ -162,2 +162,10 @@ "use strict"; | ||
}); | ||
it('can subscribe with a nameless query and gets a subId back', function () { | ||
var query = 'subscription { testSubscription }'; | ||
var callback = function () { return null; }; | ||
subManager.subscribe({ query: query, operationName: 'X', callback: callback }).then(function (subId) { | ||
expect(subId).to.be.a('number'); | ||
subManager.unsubscribe(subId); | ||
}); | ||
}); | ||
it('can subscribe with a valid query and get the root value', function (done) { | ||
@@ -270,2 +278,10 @@ var query = 'subscription X{ testSubscription }'; | ||
}); | ||
it('throws an error when trying to unsubscribe a second time', function () { | ||
var query = 'subscription X{ testSubscription }'; | ||
return subManager.subscribe({ query: query, operationName: 'X', callback: function () { } }).then(function (subId) { | ||
subManager.unsubscribe(subId); | ||
expect(function () { return subManager.unsubscribe(subId); }) | ||
.to.throw('undefined'); | ||
}); | ||
}); | ||
it('calls the error callback if there is an execution error', function (done) { | ||
@@ -272,0 +288,0 @@ var query = "subscription X($uga: Boolean!){\n testSubscription @skip(if: $uga)\n }"; |
@@ -13,3 +13,3 @@ "use strict"; | ||
OperationDefinition: function (node) { | ||
var operationName = node.name.value; | ||
var operationName = node.name ? node.name.value : ''; | ||
var numFields = 0; | ||
@@ -16,0 +16,0 @@ node.selectionSet.selections.forEach(function (selection) { |
{ | ||
"name": "graphql-subscriptions", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "GraphQL subscriptions for node.js", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -0,1 +1,3 @@ | ||
[![npm version](https://badge.fury.io/js/graphql-subscriptions.svg)](https://badge.fury.io/js/graphql-subscriptions) [![GitHub license](https://img.shields.io/github/license/apollostack/graphql-subscriptions.svg)](https://github.com/apollostack/graphql-subscriptions/blob/license/LICENSE) | ||
# graphql-subscriptions | ||
@@ -2,0 +4,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
125586
29
0
1012
82
0