0
鑑於下面的代碼,我設法通過使用QUnit來編寫第一部分的測試,但無法測試finder.doRoutefinding。我怎樣才能'嘲笑'功能finder.do路由查找? (Mockjax不能在這裏使用,因爲沒有Ajax調用參與)測試時的問題(同時使用javascript&QUnit)
`finder.doSelectDestination = function(address)
{
finder.destination = address;
finder.doRoutefinding(
finder.departure,
finder.destination,
finder.whenRouteLoaded,
finder.showRoute);
}
test('Destination Selector',
function()
{
address="London";
finder.doSelectDestination(address);
equal(pathfinder.destination,address, "Succesful Destination Selection");
}
);