• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

suculent / thinx-device-api / #252646133

07 May 2025 05:29PM UTC coverage: 55.702% (-16.3%) from 72.01%
#252646133

push

suculent
updated connect-redis

1249 of 2805 branches covered (44.53%)

Branch coverage included in aggregate %.

1 of 1 new or added line in 1 file covered. (100.0%)

1839 existing lines in 30 files now uncovered.

5365 of 9069 relevant lines covered (59.16%)

5.4 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

52.38
/spec/jasmine/ZZ-RouterNotificationsSpec.js
1
/* Router integration test only; does not have to cover full unit functionality. */
2

3
const THiNX = require("../../thinx-core.js");
1✔
4

5
let chai = require('chai');
1✔
6
var expect = require('chai').expect;
1✔
7
let chaiHttp = require('chai-http');
1✔
8
chai.use(chaiHttp);
1✔
9

10
var envi = require("../_envi.json");
1✔
11

12
let thx;
13

14
describe("Actionable Notification (noauth)", function () {
1✔
15

16
    it("POST /api/device/notification", function (done) {
1✔
17
        thx = new THiNX();
1✔
18
        thx.init(() => {
1✔
UNCOV
19
            chai.request(thx.app)
×
20
                .post('/api/device/notification')
21
                .send({})
22
                .end((err, res) => {
UNCOV
23
                    expect(res.status).to.equal(401);
×
UNCOV
24
                    done();
×
25
                });
26
        });
27
    }, 30000);
28
    
29
});
30

31
describe("Actionable Notification (JWT)", function () {
1✔
32

33
    let agent;
34
    let jwt;
35
  
36
    beforeAll((done) => {
1✔
37
        agent = chai.request.agent(thx.app);
1✔
38
        agent
1✔
39
            .post('/api/login')
40
            .send({ username: 'dynamic', password: 'dynamic', remember: false })
41
            .then(function (res) {
42
                expect(res).to.have.cookie('x-thx-core');
1✔
UNCOV
43
                let body = JSON.parse(res.text);
×
UNCOV
44
                jwt = 'Bearer ' + body.access_token;
×
UNCOV
45
                done();
×
46
            })
47
            .catch((e) => { console.log(e); });
1✔
48
    });
49
  
50
    afterAll((done) => {
1✔
51
        agent.close();
1✔
52
        done();
1✔
53
    });
54

55
    it("POST /api/device/notification (jwt, invalid)", function (done) {
1✔
UNCOV
56
        chai.request(thx.app)
×
57
                .post('/api/device/notification')
58
                .set('Authorization', jwt)
59
                .send({})
60
                .end((err, res) => {
UNCOV
61
                    expect(res.status).to.equal(200);
×
UNCOV
62
                    expect(res.text).to.be.a('string');
×
UNCOV
63
                    expect(res.text).to.equal('{"success":false,"response":"missing_udid"}');
×
UNCOV
64
                    done();
×
65
                });
66
    }, 30000);
67

68
    it("POST /api/device/notification (jwt, undefined)", function (done) {
1✔
UNCOV
69
        chai.request(thx.app)
×
70
                .post('/api/device/notification')
71
                .set('Authorization', jwt)
72
                .send({ udid: undefined, reply: undefined})
73
                .end((err, res) => {
UNCOV
74
                    expect(res.status).to.equal(200);
×
UNCOV
75
                    expect(res.text).to.equal('{"success":false,"response":"missing_udid"}');
×
UNCOV
76
                    done();
×
77
                });
78
    }, 30000);
79

80
    it("POST /api/device/notification (jwt, valid)", function (done) {
1✔
UNCOV
81
        chai.request(thx.app)
×
82
                .post('/api/device/notification')
83
                .set('Authorization', jwt)
84
                .send({ udid: envi.udid, reply: "reply"} )
85
                .end((err, res) => {
UNCOV
86
                    expect(res.status).to.equal(200);
×
UNCOV
87
                    expect(res.text).to.be.a('string');
×
UNCOV
88
                    expect(res.text).to.equal('{"success":true,"response":"published"}');
×
UNCOV
89
                    done();
×
90
                });
91
    }, 30000);
92
});
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc