metric-imperial-converter/tests/2_functional-tests.js
Rex Schrader 87ebc9c36a
Fix (Boilerplate): Add Event Parameter to test, Remove Infosec Requriements, Add Lowercase Requirement (#12)
* Fix missing event, correct example conversion

* Fix unit case

* Remove Infosec items, add lowercase requirement

* Convert to ES6, Update Packages, Fix display

* Applying @nhcarrigan's changes from site tests

* Removed unneeded mongodb ref

* Remove User Stories, Reformat README

* Apply suggestions from code review - Remove "Quality Assurance Project" Prefix

Co-authored-by: Shaun Hamilton <51722130+Sky020@users.noreply.github.com>

* Re-add the example text, clean up formatting

* Update Favicon

* Fix repo link, remove zombie.js

* Remove unused files, add sample.env

Co-authored-by: Shaun Hamilton <51722130+Sky020@users.noreply.github.com>
Co-authored-by: Rex Schrader <rex.schader@gmail.com>
2020-11-25 09:09:04 -06:00

61 lines
1.4 KiB
JavaScript

/*
*
*
* FILL IN EACH FUNCTIONAL TEST BELOW COMPLETELY
* -----[Keep the tests in the same order!]-----
* (if additional are added, keep them at the very end!)
*/
const chaiHttp = require('chai-http');
const chai = require('chai');
let assert = chai.assert;
const server = require('../server');
chai.use(chaiHttp);
suite('Functional Tests', function() {
suite('Routing Tests', function() {
suite('GET /api/convert => conversion object', function() {
test('Convert 10L (valid input)', function(done) {
chai.request(server)
.get('/api/convert')
.query({input: '10L'})
.end(function(err, res){
assert.equal(res.status, 200);
assert.equal(res.body.initNum, 10);
assert.equal(res.body.initUnit, 'l');
assert.approximately(res.body.returnNum, 2.64172, 0.1);
assert.equal(res.body.returnUnit, 'gal');
done();
});
});
test('Convert 32g (invalid input unit)', function(done) {
//done();
});
test('Convert 3/7.2/4kg (invalid number)', function(done) {
//done();
});
test('Convert 3/7.2/4kilomegagram (invalid number and unit)', function(done) {
//done();
});
test('Convert kg (no number)', function(done) {
//done();
});
});
});
});