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

suculent / thinx-device-api / #252646770

01 Nov 2025 03:54PM UTC coverage: 71.849% (+25.6%) from 46.298%
#252646770

push

suculent
testing fixed broker URL configuration after MQTT upgrade

1867 of 3538 branches covered (52.77%)

Branch coverage included in aggregate %.

27 of 38 new or added lines in 1 file covered. (71.05%)

20 existing lines in 10 files now uncovered.

8212 of 10490 relevant lines covered (78.28%)

7.49 hits per line

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

97.62
/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)
1✔
20
                .post('/api/device/notification')
21
                .send({})
22
                .end((err, res) => {
23
                    expect(res.status).to.equal(401);
1✔
24
                    done();
1✔
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);
1✔
44
                jwt = 'Bearer ' + body.access_token;
1✔
45
                done();
1✔
46
            })
UNCOV
47
            .catch((e) => { console.log(e); });
×
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)
1✔
57
                .post('/api/device/notification')
58
                .set('Authorization', jwt)
59
                .send({})
60
                .end((err, res) => {
61
                    expect(res.status).to.equal(200);
1✔
62
                    expect(res.text).to.be.a('string');
1✔
63
                    expect(res.text).to.equal('{"success":false,"response":"missing_udid"}');
1✔
64
                    done();
1✔
65
                });
66
    }, 30000);
67

68
    it("POST /api/device/notification (jwt, undefined)", function (done) {
1✔
69
        chai.request(thx.app)
1✔
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);
1✔
75
                    expect(res.text).to.equal('{"success":false,"response":"missing_udid"}');
1✔
76
                    done();
1✔
77
                });
78
    }, 30000);
79

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