Skip to content
Snippets Groups Projects
Commit fac54082 authored by Rudolf Copi Eckelberg's avatar Rudolf Copi Eckelberg
Browse files

Even more simulation tests

parent cd664360
No related branches found
No related tags found
2 merge requests!116Release v1.0.0,!25Auth
Pipeline #
......@@ -194,6 +194,23 @@ describe('Requires a simulation', () => {
done();
});
});
it('should not create a nameless simulation', (done) => {
chai.request(server)
.post('/api/v1/simulation')
.set('content-type', 'application/x-www-form-urlencoded')
.set('x-apicache-bypass', 'true')
.end((err, res) => {
res.should.have.status(200);
res.should.be.json;
res.body.should.not.have.property('id');
res.body.should.have.property('success');
res.body.success.should.equal(false);
Simulation.findById(res.body.id, (err, simulation) => {
expect(simulation).to.not.exist;
});
done();
});
});
it('should find an existing simulation', (done) => {
newSimulation = new Simulation();
newSimulation.name = 'test';
......@@ -212,6 +229,19 @@ describe('Requires a simulation', () => {
});
});
});
it('should not find an unexisting simulation', (done) => {
newSimulation = new Simulation();
let id = newSimulation._id;
chai.request(server)
.get(`/api/v1/simulation/${id}`)
.end((err, res) => {
res.should.have.status(200);
res.should.be.json;
res.body.should.have.property('success');
res.body.success.should.equal(false);
done();
});
});
it('should update an existing simulation\'s location', (done) => {
newSimulation = new Simulation();
newSimulation.name = 'test';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment