2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-20 20:00:40 +03:00

Moving test helpers and auto-loading them

This commit is contained in:
Matt Zabriskie
2016-03-07 13:21:27 -07:00
parent 0da38da921
commit dcbb352262
19 changed files with 141 additions and 124 deletions
+8 -11
View File
@@ -1,29 +1,26 @@
var __btoa = require('../../../lib/helpers/btoa');
var validateInvalidCharacterError = require('../__validateInvalidCharacterError');
describe('btoa polyfill', function () {
it('should behave the same as native window.btoa', function () {
// btoa doesn't exist in IE8/9
if (isOldIE && typeof Int8Array === 'undefined') {
return;
}
var data = 'Hello, world';
expect(__btoa(data)).toEqual(window.btoa(data));
});
it('should throw an error if char is out of range 0xFF', function () {
var err1, err2;
var err;
var data = 'I ♡ Unicode!';
try {
window.btoa(data);
} catch (e) {
err1 = e;
}
try {
__btoa(data);
} catch (e) {
err2 = e;
err = e;
}
validateInvalidCharacterError(err1);
validateInvalidCharacterError(err2);
validateInvalidCharacterError(err);
});
});