Methods returns an array of info object of car 3
belonging to given (searchKey) of car XXL
.
For example 3
returns
[
{"info": {
"consumptionPer100km": 6,
"comments": "low emission",
"powerSource": "pushing"
}}
]
If no car with the given searchKey(or wrong searchKey) is found returns a null. If a parameter searchKey is missing, null will be returned. If the car with the given searchKey has no info returns a null.
Test uses the default data.
Create register with default data.
const register = new carRegister(defaultData);
register.getInfo(3),
expect
[
{"info": {
"consumptionPer100km": 1,
"comments": "low emission",
"powerSource": "pushing"
}}
]
to be returned
Test uses the default data.
Create register with default data.
const register = new carRegister(defaultData);
register.getInfo(2),
expect
[
{"info": {
"consumptionPer100km": 4,
"comments": "-",
"powerSource": "hybrid"
}},
{}
]
to be returned
Test uses the default data.
Create register with default data.
const register = new carRegister(defaultData);
register.getInfo('x'),
return null
Test uses the default data.
Create register with default data.
const register = new carRegister(defaultData);
register.getInfo(''),
return null
Test uses the default data.
Create register with default data.
const register = new carRegister(defaultData);
register.getInfo(''),
return null