Prevent using fetch or ReadableStream in tests

Until they can be mocked, they can't be used
This commit is contained in:
Michael Lange
2017-11-15 18:11:24 -08:00
parent 80e925467f
commit f283287d40
2 changed files with 8 additions and 1 deletions

View File

@@ -1,6 +1,8 @@
import Ember from 'ember';
import fetch from 'fetch';
// The ember-fetch polyfill does not provide streaming
const fetchToUse = window.fetch || fetch;
// Additionally, Mirage/Pretender does not support fetch
const fetchToUse = Ember.testing ? fetch : window.fetch || fetch;
export default fetchToUse;

View File

@@ -21,6 +21,11 @@
{{content-for "body"}}
{{content-for "test-body"}}
<script>
// Spoof a lack of ReadableStream support to use XHRs instead of Fetch
window.__ReadableStream = window.ReadableStream;
window.ReadableStream = undefined;
</script>
<script src="/testem.js" integrity=""></script>
<script src="{{rootURL}}assets/vendor.js"></script>
<script src="{{rootURL}}assets/test-support.js"></script>