1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | var path = require('path'),
|
9 | vows = require('vows'),
|
10 | assert = require('assert'),
|
11 | nock = require('nock'),
|
12 | helpers = require('./helpers');
|
13 |
|
14 | var options = {},
|
15 | testContext = {},
|
16 | config = helpers.loadConfig(),
|
17 | loggly = require('../lib/loggly').createClient(config);
|
18 |
|
19 | vows.describe('node-loggly/customer').addBatch({
|
20 | "When using the node-loggly client": {
|
21 | "the customer() method": {
|
22 | topic: function() {
|
23 | nock("https://" + config.subdomain + ".loggly.com")
|
24 | .get('/apiv2/customer')
|
25 | .reply(200, {
|
26 | "tokens": ["test", "test2"],
|
27 | "subdomain": config.subdomain,
|
28 | "subscription": {
|
29 | "key1": "value1"
|
30 | }
|
31 | });
|
32 | loggly.customer(this.callback);
|
33 |
|
34 | },
|
35 | "should return a valid customer": function(err, customer) {
|
36 | assert.isNull(err);
|
37 | assert.isArray(customer.tokens);
|
38 | assert.isString(customer.subdomain);
|
39 | assert.isObject(customer.subscription);
|
40 | }
|
41 | }
|
42 | }
|
43 | }).export(module);
|