1 | 'use strict';
|
2 |
|
3 | var assert = require('assert'),
|
4 | when = require('when'),
|
5 | rewire = require('rewire'),
|
6 | constants = require('../lib/constants'),
|
7 | mocks = require('./mocks');
|
8 |
|
9 | describe('AkamaiQueueLength', function () {
|
10 |
|
11 | describe('basic queue request', function () {
|
12 | beforeEach(function () {
|
13 |
|
14 | this.object = rewire('./../lib/queue.js');
|
15 | this.object.__set__('AkamaiRequest', mocks.AkamaiRequest.standardGood({
|
16 | uri: constants.AKAMAI_API_QUEUE,
|
17 | method: 'GET',
|
18 | json: true,
|
19 | auth: {
|
20 | username: 'someusername',
|
21 | password: 'supersecret'
|
22 | }
|
23 | }, {
|
24 | httpStatus: 200,
|
25 | queueLength: 17
|
26 | }));
|
27 | });
|
28 |
|
29 |
|
30 | it('should make request', function (done) {
|
31 | var statusRequest = this.object.AkamaiQueueLength('someusername', 'supersecret').then(function (response) {
|
32 | assert.equal(response.httpStatus, 200);
|
33 | }.bind(this)).then(done).catch(done);
|
34 |
|
35 | assert.equal(when.isPromiseLike(statusRequest), true);
|
36 | });
|
37 |
|
38 | });
|
39 | }); |
\ | No newline at end of file |