2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-08 17:22:34 +03:00
Files
axios/test/specs/helpers/btoa.spec.js
T
2015-12-14 12:16:57 -07:00

28 lines
586 B
JavaScript

var __btoa = require('../../../lib/helpers/btoa');
describe('btoa polyfill', function () {
it('should behave the same as native window.btoa', function () {
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 data = 'I ♡ Unicode!';
try {
window.btoa(data);
} catch (e) {
err1 = e;
}
try {
__btoa(data);
} catch (e) {
err2 = e;
}
expect(err1.message).toEqual(err2.message);
});
});