diff --git a/src/test/test.js b/src/test/test.js index 55d96515333982fb5251280678418f78546fe206..e3f03fc2ef4aecc600c4a06fa6607e51119945bd 100644 --- a/src/test/test.js +++ b/src/test/test.js @@ -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';