私は外部スクリプト ( http://segment.ioから) を使用しており、それとやり取りする AngularJS モジュールを作成しています。
スクリプトが適切にロードされていることを効果的にテストするにはどうすればよいでしょうか (実際のアプリを実行する場合を除く)。
end2end テストを作成する必要がありますか?
ご協力いただきありがとうございます!
// Service is a factory
service.load = function(apiKey) {
// Create an async script element for analytics.js.
var script = document.createElement('script');
script.type = 'text/javascript';
script.async = true;
script.src = ('https:' === document.location.protocol ? 'https://' : 'http://') +
'd2dq2ahtl5zl1z.cloudfront.net/analytics.js/v1/' + apiKey + '/analytics.js';
// Find the first script element on the page and insert our script next to it.
var firstScript = document.getElementsByTagName('script')[0];
firstScript.parentNode.insertBefore(script, firstScript);
};