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

suculent / thinx-device-api / #252646768

01 Nov 2025 03:31PM UTC coverage: 46.298% (-25.7%) from 71.971%
#252646768

push

suculent
testing upgraded mqtt package

1123 of 3470 branches covered (32.36%)

Branch coverage included in aggregate %.

5324 of 10455 relevant lines covered (50.92%)

4.07 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✔
19
            chai.request(thx.app)
×
20
                .post('/api/device/notification')
21
                .send({})
22
                .end((err, res) => {
23
                    expect(res.status).to.equal(401);
×
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✔
43
                let body = JSON.parse(res.text);
×
44
                jwt = 'Bearer ' + body.access_token;
×
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✔
56
        chai.request(thx.app)
×
57
                .post('/api/device/notification')
58
                .set('Authorization', jwt)
59
                .send({})
60
                .end((err, res) => {
61
                    expect(res.status).to.equal(200);
×
62
                    expect(res.text).to.be.a('string');
×
63
                    expect(res.text).to.equal('{"success":false,"response":"missing_udid"}');
×
64
                    done();
×
65
                });
66
    }, 30000);
67

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

80
    it("POST /api/device/notification (jwt, valid)", function (done) {
1✔
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) => {
86
                    expect(res.status).to.equal(200);
×
87
                    expect(res.text).to.be.a('string');
×
88
                    expect(res.text).to.equal('{"success":true,"response":"published"}');
×
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