Issues (95)

test/app-test.js (1 issue)

1
'use strict';
2
3
var chai = require('chai'),
4
    expect = require('chai').expect,
5
    app = require('../app').app,
6
    chaiHttp = require('chai-http'),
7
    server = require('../app'),
8
    should = chai.should(),
9
    SDK = require("../node_modules/ringcentral/src/SDK"),
10
    request = require('supertest').agent(app.listen()),
11
    supertest = require('supertest'),
12
    sinon = require('sinon'),
13
    ejs = require('ejs'),
14
    handlebars = require('handlebars'),
15
    superagent = require('superagent');
16
17
18
19
describe('/GET Home Page', function() {
20
21
    it('it should render the home page', function() {
22
23
        var fields, html;
24
25
        beforeEach(function() {
26
            this.fields = { first: "123" };
27
            this.html = "{{#ifequal first last}}true{{else}}false{{/ifequal}}";
28
        });
29
30
        it('will return false when the values are not equal', function() {
31
            var template =  Handlebars.compile(this.html);
32
            this.fields['last'] = 123;
33
            var result = template(this.fields);
34
            expect(result).toEqual("false");
35
        });
36
37
        it('will return true when the values are equal', function() {
38
            var template =  Handlebars.compile(this.html)
39
            this.fields['last'] = "123";
40
            var result = template(this.fields)
41
            expect(result).toEqual("true");
42
        });
43
44
    });
45
46
});
47
48
49
describe('RingCentral', function() {
50
51
    function test(suite, server, done) {
0 ignored issues
show
The parameter done is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
52
53
        suite.timeout(10000); // Per SLA should be 3 seconds
54
        var sdk = new SDK({server: server, appKey: '', appSecret: ''});
55
56
        return sdk.platform().get('', null, {skipAuthCheck: true}).then(function(response) {
57
            expect(response.json().uri).to.equal(server + '/restapi/v1.0');
58
            sdk.cache().clean();
59
        });
60
    }
61
62
    it('connects to sandbox', function() {
63
        return test(this, SDK.server.sandbox);
64
    });
65
66
    it('connects to production', function() {
67
        return test(this, SDK.server.production);
68
    });
69
70
71
72
});
73
74
75
describe('homepage', function(){
76
    it('should respond to GET',function(){
77
        superagent
78
            .get('http://localhost:'+app.port)
79
            .end(function(res){
80
                expect(res.status).to.equal(200);
81
                done()
82
            })
83
    });
84
});