CartoDB-SQL-API/test/integration/batch/job-publisher-test.js
Daniel García Aubert 0c92fcaf96 Node.js 12 support:
- Update `gc-stats` to version 1.4.0
- Replace `zipfile` -> `adm-zip`
- Update `libxmljs` to version 0.19.7
- Update `sqlite` to version 4.2.0
- Adapted pool acquires to the new version of `cartodb-redis`
- Adapted test to use `adm-zip`
2020-05-18 11:32:41 +02:00

38 lines
1.1 KiB
JavaScript

'use strict';
require('../../helper');
var BATCH_SOURCE = '../../../lib/batch/';
var assert = require('../../support/assert');
var redisUtils = require('../../support/redis-utils');
var Channel = require(BATCH_SOURCE + 'pubsub/channel');
var JobPublisher = require(BATCH_SOURCE + 'pubsub/job-publisher');
var HOST = 'wadus';
describe('job publisher', function () {
var jobPublisher = new JobPublisher(redisUtils.getPool());
it('.publish() should publish in job channel', function (done) {
redisUtils.getPool().acquire(Channel.DB)
.then(client => {
client.subscribe(Channel.NAME);
client.on('message', function (channel, host) {
assert.strictEqual(host, HOST);
assert.strictEqual(channel, Channel.NAME);
client.unsubscribe(Channel.NAME);
redisUtils.getPool().release(Channel.DB, client)
.then(() => done())
.catch((err) => done(err));
});
jobPublisher.publish(HOST);
})
.catch((err) => done(err));
});
});