Adding tests to cover regressions when upgrading to babel 7
Reviewed By: mjesun Differential Revision: D7123659 fbshipit-source-id: f344786dfe5e4c6c0d81992504ba93688edeb5db
This commit is contained in:
parent
e839c91946
commit
6eef7de46e
|
@ -13,8 +13,39 @@ jest.setMock('NativeModules', {
|
|||
BlobModule: require('../__mocks__/BlobModule'),
|
||||
});
|
||||
|
||||
const Blob = require('Blob');
|
||||
const File = require('File');
|
||||
|
||||
describe('babel 7 smoke test', function() {
|
||||
it('should be able to extend a class with native name', function() {
|
||||
let called = false;
|
||||
class Array {
|
||||
constructor() {
|
||||
called = true;
|
||||
return {foo: 'PASS'};
|
||||
}
|
||||
}
|
||||
class A extends Array {
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
// there is/was a regression in Babel where this would break and super()
|
||||
// would not actually invoke the constructor of the parent class if the
|
||||
// parent class had a name matching a built-in class (like Blob)
|
||||
expect(new A().foo).toBe('PASS');
|
||||
expect(called).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Blob', function() {
|
||||
it('regression caused by circular dep && babel 7', function() {
|
||||
const blob = new Blob([], {type: 'image/jpeg'});
|
||||
expect(blob).toBeInstanceOf(Blob);
|
||||
});
|
||||
});
|
||||
|
||||
describe('File', function() {
|
||||
it('should create empty file', () => {
|
||||
const file = new File([], 'test.jpg');
|
||||
|
|
Loading…
Reference in New Issue