Skip to content

Commit

Permalink
add senseBox MCU-S2 to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mariopesch committed Dec 11, 2023
1 parent a5d35ca commit 548c354
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const params = {

let downloadId_mcu = '';
let downloadId_uno = '';
let downloadId_esp32s2 = '';

describe('Compiler', () => {
describe('/GET index', () => {
Expand Down Expand Up @@ -64,6 +65,26 @@ describe('Compiler', () => {
})
});

it('should compile a sketch for senseBox MCU-S2 ESP32S2', (done) => {
const { sketch } = params;
chai.request(server)
.post('/compile')
.send({
board: 'sensebox-esp32s2',
sketch
})
.end((err, res) => {
res.should.have.status(200);
res.body.should.be.a('object');
res.body.should.have.property('message').eql('Sketch successfully compiled and created!');
res.body.should.have.property('data');
res.body.data.should.be.a('object');
res.body.data.should.have.property('id');
downloadId_esp32s2 = res.body.data.id;
done();
})
});

it('should reject request without board parameter', (done) => {
const { sketch } = params;
chai.request(server)
Expand Down Expand Up @@ -169,6 +190,18 @@ describe('Compiler', () => {
});
});

it('should download sketch for senseBox MCU-S2 ESP32S2', (done) => {
chai.request(server)
.get('/download')
.query({ board: 'sensebox_esp32s2', id: downloadId_esp32s2 })
.end((err, res) => {
res.should.have.status(200);
res.header.should.be.a('object');
res.header.should.have.property('content-disposition').eql("attachment; filename=sketch.bin");
done();
});
});

it('should reject request without id parameter', (done) => {
chai.request(server)
.get('/download')
Expand Down

0 comments on commit 548c354

Please sign in to comment.