Socket
Socket
Sign inDemoInstall

nsq-publisher

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nsq-publisher - npm Package Compare versions

Comparing version 1.0.0 to 1.0.2

10

lib/index.js

@@ -21,3 +21,3 @@ const Promise = require('bluebird-tools');

if (!callback) {
return new Promise((resolve, reject) => {
return Promise.when(() => !this._topicCreated, () => new Promise((resolve, reject) => {
request.post(this.topicUrl, (err) => {

@@ -30,5 +30,9 @@ if (err) {

});
});
}));
}
if (this._topicCreated) {
callback();
return;
}
request.post(this.topicUrl, (err) => {

@@ -46,3 +50,3 @@ if (err) {

if (!callback) {
return Promise.when(() => this._topicCreated && this.autoCreate, this.createTopic)
return Promise.when(() => this.autoCreate, this.createTopic)
.then(() => new Promise((resolve, reject) => {

@@ -49,0 +53,0 @@ const nsqWriter = new nsq.Writer(this.dataUrl, this.dataTcpPort);

{
"name": "nsq-publisher",
"version": "1.0.0",
"version": "1.0.2",
"description": "Simple way to create topics and publish messages in NSQ",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -0,0 +0,0 @@ # NSQ Publisher

@@ -87,6 +87,16 @@ const Promise = require('bluebird-tools');

suite('#createTopic', function() {
test('calls the request.post once', (done) => {
test('never calls the request.post when _createTopic is true', (done) => {
const publisher = new NsqPublisher({});
publisher._topicCreated = true;
publisher.createTopic()
.then(() => {
expect(requestMock.post.called).to.be.false;
done();
})
.catch(err => done(err));
});
test('calls the request.post once when _createTopic is false', (done) => {
const publisher = new NsqPublisher({});
publisher.createTopic()
.then(() => {
expect(requestMock.post.calledOnce).to.be.true;

@@ -93,0 +103,0 @@ done();

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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc