2
0
mirror of https://github.com/tenrok/axios.git synced 2026-05-30 15:24:11 +03:00
Files
axios/test/specs/helpers/btoa.spec.js
T
2016-03-07 13:21:27 -07:00

27 lines
605 B
JavaScript

var __btoa = require('../../../lib/helpers/btoa');
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 err;
var data = 'I ♡ Unicode!';
try {
__btoa(data);
} catch (e) {
err = e;
}
validateInvalidCharacterError(err);
});
});