0
테스트 환경으로 카르마/모카를 사용하고 있습니다. url을 얻으려면 window.location.href에 의존하는 js 파일이 있습니다. Karma를 사용하여 테스트를 수행 할 때 기본 URL은 www.localhost : 3123/context.html입니다. url/add 매개 변수를 변경하거나이 특정 테스트 스위트에 대한 사용자 정의 URL을 사용하도록 karma에 말할 수 있습니까?모카/카르마 스택의 window.location.href 변경
//JS file has
function populate(){
var url = new URL(window.location.href);
-- check if the url have parameter, lets say carInfo
-- if has then dispatches an event
}
//Mocha test
describe('...', function() {
it ('...', function() {
-- call populate()
-- listen if the event was triggered
})
})