UNPKG

ac-koa

Version:

Modules for building Atlassian Connect and HipChat Connect add-ons

54 lines (42 loc) 1.53 kB
var assert = require('assert'); var util = require('../lib/util'); var request = require('request'); var ac = require('ac-node'); var ack = require('../lib'); var pkg = require('../package.json'); describe('ack app', function () { describe('services', function () { var app; it('should use a default http client lib when none is specified', function *() { app = ack(pkg); assert.equal(app.httpClient, request); }); it('should use a specific http client lib when given an object', function *() { var testClient = {}; app = ack(pkg, {httpClient: testClient}); assert.equal(app.httpClient, testClient); }); it('should use a redis store when none is specified', function *() { app = ack(pkg); assert.ok(app.store instanceof ac.RedisStore); }); it('should use a specific store when given an object', function *() { var testStore = {}; app = ack(pkg, {store: testStore}); assert.ok(app.store === testStore); }); it('should use a built-in store when given an available constructor name', function *() { app = ack(pkg, {store: 'MemoryStore'}); assert.ok(app.store instanceof ac.MemoryStore); }); it('should use a store produced from a factory', function *() { var testStore = {}; app = ack(pkg, {store: function (config, scope) { assert.ok(config); assert.equal(scope, 'ack'); return testStore; }}); assert.equal(app.store, testStore); }); }); });