The following is what I would expect to see when the app runs:
Listening on port 3000
Running Tests...
Unit Tests
Function convertHandler.getNum(input)
β Whole number input
β Decimal Input
β Fractional Input
β Fractional Input w/ Decimal
β Invalid Input (double fraction)
β No Numerical Input
Function convertHandler.getUnit(input)
β For Each Valid Unit Inputs
β Unknown Unit Input
Function convertHandler.getReturnUnit(initUnit)
β For Each Valid Unit Inputs
Function convertHandler.spellOutUnit(unit)
β For Each Valid Unit Inputs
Function convertHandler.convert(num, unit)
β Gal to L
β L to Gal
β Mi to Km
β Km to Mi
β Lbs to Kg
β Kg to Lbs
Functional Tests
Routing Tests
GET /api/convert => conversion object
β Convert 10L (valid input)
β Convert 32g (invalid input unit)
β Convert 3/7.2/4kg (invalid number)
β Convert 3/7.2/4kilomegagram (invalid number and unit)
β Convert kg (no number)
21 passing (56ms)
You should have not messed with test-runner.js
or fcc-testing
because you have tweaked something that is causing no tests to be sent back to freeCodeCamp.
A call to https://suemetricimperialconvert.herokuapp.com/_api/get-tests
should send back a response like:
[
{
"title": "Whole number input",
"context": " -> Unit Tests -> Function convertHandler.getNum(input)",
"state": "passed",
"assertions": [
{
"method": "equal",
"args": [
"convertHandler.getNum(input)",
"32"
]
},
{
"method": "equal",
"args": [
"convertHandler.getNum(input)",
"1060934"
]
},
{
"method": "equal",
"args": [
"convertHandler.getNum(input)",
"123"
]
}
]
},
{
"title": "Decimal Input",
"context": " -> Unit Tests -> Function convertHandler.getNum(input)",
"state": "passed",
"assertions": [
{
"method": "equal",
"args": [
"convertHandler.getNum(input)",
"4.3"
]
}
]
},
{
"title": "Fractional Input",
"context": " -> Unit Tests -> Function convertHandler.getNum(input)",
"state": "passed",
"assertions": [
{
"method": "equal",
"args": [
"convertHandler.getNum(input)",
"3/4"
]
},
{
"method": "isNull",
"args": [
"convertHandler.getNum(input)",
"\"Divide by zero should return null\""
]
},
{
"method": "equal",
"args": [
"convertHandler.getNum(input)",
"1/3"
]
}
]
},
{
"title": "Fractional Input w/ Decimal",
"context": " -> Unit Tests -> Function convertHandler.getNum(input)",
"state": "passed",
"assertions": [
{
"method": "equal",
"args": [
"convertHandler.getNum(input)",
"0.5"
]
},
{
"method": "equal",
"args": [
"convertHandler.getNum(input)",
"9"
]
},
{
"method": "equal",
"args": [
"convertHandler.getNum(input)",
"8/1.4"
]
},
{
"method": "isNull",
"args": [
"convertHandler.getNum(input)",
"\"Divide by zero should return null\""
]
}
]
},
{
"title": "Invalid Input (double fraction)",
"context": " -> Unit Tests -> Function convertHandler.getNum(input)",
"state": "passed",
"assertions": [
{
"method": "isNull",
"args": [
"convertHandler.getNum(input)",
"\"Double fractions should return null\""
]
}
]
},
{
"title": "No Numerical Input",
"context": " -> Unit Tests -> Function convertHandler.getNum(input)",
"state": "passed",
"assertions": [
{
"method": "equal",
"args": [
"convertHandler.getNum(input)",
"1"
]
},
{
"method": "equal",
"args": [
"convertHandler.getNum(input)",
"1"
]
},
{
"method": "equal",
"args": [
"convertHandler.getNum(input)",
"1"
]
},
{
"method": "equal",
"args": [
"convertHandler.getNum(input)",
"1"
]
}
]
},
{
"title": "For Each Valid Unit Inputs",
"context": " -> Unit Tests -> Function convertHandler.getUnit(input)",
"state": "passed",
"assertions": [
{
"method": "equal",
"args": [
"convertHandler.getUnit(1 + ele)",
"output[index]"
]
}
]
},
{
"title": "Unknown Unit Input",
"context": " -> Unit Tests -> Function convertHandler.getUnit(input)",
"state": "passed",
"assertions": [
{
"method": "isNull",
"args": [
"convertHandler.getUnit('123kgm')"
]
},
{
"method": "isNull",
"args": [
"convertHandler.getUnit('123kmg')"
]
},
{
"method": "isNull",
"args": [
"convertHandler.getUnit('123lkg')"
]
},
{
"method": "isNull",
"args": [
"convertHandler.getUnit('123lb')"
]
},
{
"method": "isNull",
"args": [
"convertHandler.getUnit('123k')"
]
}
]
},
{
"title": "For Each Valid Unit Inputs",
"context": " -> Unit Tests -> Function convertHandler.getReturnUnit(initUnit)",
"state": "passed",
"assertions": [
{
"method": "equal",
"args": [
"convertHandler.getReturnUnit(ele)",
"expect[i]"
]
}
]
},
{
"title": "For Each Valid Unit Inputs",
"context": " -> Unit Tests -> Function convertHandler.spellOutUnit(unit)",
"state": "passed",
"assertions": [
{
"method": "equal",
"args": [
"convertHandler.spellOutUnit(ele)",
"expect[i]"
]
}
]
},
{
"title": "Gal to L",
"context": " -> Unit Tests -> Function convertHandler.convert(num, unit)",
"state": "passed",
"assertions": [
{
"method": "approximately",
"args": [
"convertHandler.convert(input[0],input[1])",
"expected",
"0.1"
]
}
]
},
{
"title": "L to Gal",
"context": " -> Unit Tests -> Function convertHandler.convert(num, unit)",
"state": "passed",
"assertions": [
{
"method": "approximately",
"args": [
"convertHandler.convert(input[0],input[1])",
"expected",
"0.1"
]
}
]
},
{
"title": "Mi to Km",
"context": " -> Unit Tests -> Function convertHandler.convert(num, unit)",
"state": "passed",
"assertions": [
{
"method": "approximately",
"args": [
"convertHandler.convert(input[0],input[1])",
"expected",
"0.1"
]
}
]
},
{
"title": "Km to Mi",
"context": " -> Unit Tests -> Function convertHandler.convert(num, unit)",
"state": "passed",
"assertions": [
{
"method": "approximately",
"args": [
"convertHandler.convert(input[0],input[1])",
"expected",
"0.1"
]
}
]
},
{
"title": "Lbs to Kg",
"context": " -> Unit Tests -> Function convertHandler.convert(num, unit)",
"state": "passed",
"assertions": [
{
"method": "approximately",
"args": [
"convertHandler.convert(input[0],input[1])",
"expected",
"0.1"
]
}
]
},
{
"title": "Kg to Lbs",
"context": " -> Unit Tests -> Function convertHandler.convert(num, unit)",
"state": "passed",
"assertions": [
{
"method": "approximately",
"args": [
"convertHandler.convert(input[0],input[1])",
"expected",
"0.1"
]
}
]
},
{
"title": "Convert 10L (valid input)",
"context": " -> Functional Tests -> Routing Tests -> GET /api/convert => conversion object",
"state": "passed",
"assertions": [
{
"method": "equal",
"args": [
"res.status",
"200"
]
},
{
"method": "equal",
"args": [
"res.body.initNum",
"10"
]
},
{
"method": "equal",
"args": [
"res.body.initUnit",
"'L'"
]
},
{
"method": "approximately",
"args": [
"res.body.returnNum",
"2.64172",
"0.1"
]
},
{
"method": "equal",
"args": [
"res.body.returnUnit",
"'gal'"
]
}
]
},
{
"title": "Convert 32g (invalid input unit)",
"context": " -> Functional Tests -> Routing Tests -> GET /api/convert => conversion object",
"state": "passed",
"assertions": [
{
"method": "equal",
"args": [
"res.status",
"200"
]
},
{
"method": "equal",
"args": [
"res.text",
"\"invalid unit\""
]
}
]
},
{
"title": "Convert 3/7.2/4kg (invalid number)",
"context": " -> Functional Tests -> Routing Tests -> GET /api/convert => conversion object",
"state": "passed",
"assertions": [
{
"method": "equal",
"args": [
"res.status",
"200"
]
},
{
"method": "equal",
"args": [
"res.text",
"\"invalid number\""
]
}
]
},
{
"title": "Convert 3/7.2/4kilomegagram (invalid number and unit)",
"context": " -> Functional Tests -> Routing Tests -> GET /api/convert => conversion object",
"state": "passed",
"assertions": [
{
"method": "equal",
"args": [
"res.status",
"200"
]
},
{
"method": "equal",
"args": [
"res.text",
"\"invalid number and unit\""
]
}
]
},
{
"title": "Convert kg (no number)",
"context": " -> Functional Tests -> Routing Tests -> GET /api/convert => conversion object",
"state": "passed",
"assertions": [
{
"method": "equal",
"args": [
"res.status",
"200"
]
},
{
"method": "equal",
"args": [
"res.body.initNum",
"1"
]
},
{
"method": "equal",
"args": [
"res.body.initUnit",
"'kg'"
]
},
{
"method": "approximately",
"args": [
"res.body.returnNum",
"2.20462",
"0.1"
]
},
{
"method": "equal",
"args": [
"res.body.returnUnit",
"'lbs'"
]
}
]
}
]
Instead, the response is [ ]