re-enable and fix tests

Summary:
When bringing back `node-haste` to React Native, I left an `fdescribe` in a test that led to ~70 tests being skipped.
This re-enables these tests, and fixes test failures

Reviewed By: cpojer

Differential Revision: D3811225

fbshipit-source-id: 67a16f385759bb829f1f3f559862eab7e78f2097
This commit is contained in:
David Aurelio 2016-09-03 01:11:34 -07:00 committed by Facebook Github Bot 0
parent 5ba40fe6ef
commit 13994d5810
3 changed files with 27 additions and 18 deletions

View File

@ -16,8 +16,10 @@ jest
Networking: {
addListener: function() {},
removeListeners: function() {},
sendRequest: (options, callback) => {
callback(1);
sendRequest(options, callback) {
if (typeof callback === 'function') { // android does not pass a callback
callback(1);
}
},
abortRequest: function() {},
}

View File

@ -10,7 +10,12 @@
jest.disableAutomock();
var processColor = require('processColor');
const {OS} = require('Platform');
const processColor = require('processColor');
const platformSpecific = OS === 'android'
? unsigned => unsigned | 0 //eslint-disable-line no-bitwise
: x => x;
describe('processColor', () => {
@ -19,25 +24,25 @@ describe('processColor', () => {
it('should convert red', () => {
var colorFromString = processColor('red');
var expectedInt = 0xFFFF0000;
expect(colorFromString).toEqual(expectedInt);
expect(colorFromString).toEqual(platformSpecific(expectedInt));
});
it('should convert white', () => {
var colorFromString = processColor('white');
var expectedInt = 0xFFFFFFFF;
expect(colorFromString).toEqual(expectedInt);
expect(colorFromString).toEqual(platformSpecific(expectedInt));
});
it('should convert black', () => {
var colorFromString = processColor('black');
var expectedInt = 0xFF000000;
expect(colorFromString).toEqual(expectedInt);
expect(colorFromString).toEqual(platformSpecific(expectedInt));
});
it('should convert transparent', () => {
var colorFromString = processColor('transparent');
var expectedInt = 0x00000000;
expect(colorFromString).toEqual(expectedInt);
expect(colorFromString).toEqual(platformSpecific(expectedInt));
});
});
@ -46,7 +51,7 @@ describe('processColor', () => {
it('should convert rgb(x, y, z)', () => {
var colorFromString = processColor('rgb(10, 20, 30)');
var expectedInt = 0xFF0A141E;
expect(colorFromString).toEqual(expectedInt);
expect(colorFromString).toEqual(platformSpecific(expectedInt));
});
});
@ -56,7 +61,7 @@ describe('processColor', () => {
it('should convert rgba(x, y, z, a)', () => {
var colorFromString = processColor('rgba(10, 20, 30, 0.4)');
var expectedInt = 0x660A141E;
expect(colorFromString).toEqual(expectedInt);
expect(colorFromString).toEqual(platformSpecific(expectedInt));
});
});
@ -66,7 +71,7 @@ describe('processColor', () => {
it('should convert hsl(x, y%, z%)', () => {
var colorFromString = processColor('hsl(318, 69%, 55%)');
var expectedInt = 0xFFDB3DAC;
expect(colorFromString).toEqual(expectedInt);
expect(colorFromString).toEqual(platformSpecific(expectedInt));
});
});
@ -76,7 +81,7 @@ describe('processColor', () => {
it('should convert hsla(x, y%, z%, a)', () => {
var colorFromString = processColor('hsla(318, 69%, 55%, 0.25)');
var expectedInt = 0x40DB3DAC;
expect(colorFromString).toEqual(expectedInt);
expect(colorFromString).toEqual(platformSpecific(expectedInt));
});
});
@ -86,7 +91,7 @@ describe('processColor', () => {
it('should convert #xxxxxx', () => {
var colorFromString = processColor('#1e83c9');
var expectedInt = 0xFF1E83C9;
expect(colorFromString).toEqual(expectedInt);
expect(colorFromString).toEqual(platformSpecific(expectedInt));
});
});

View File

@ -1273,8 +1273,8 @@ describe('DependencyGraph', function() {
`Failed to build DependencyGraph: @providesModule naming collision:\n` +
` Duplicate module name: index\n` +
` Paths: /root/b.js collides with /root/index.js\n\n` +
`This error is caused by a @providesModule declaration ` +
`with the same name across two different files.`
'This error is caused by a @providesModule declaration ' +
'with the same name across two different files.'
);
expect(err.type).toEqual('DependencyGraphError');
});
@ -2608,15 +2608,17 @@ describe('DependencyGraph', function() {
let DependencyGraph;
beforeEach(function() {
process.platform = 'win32';
DependencyGraph = require('../index'); // force reload with fastpath
// force reload with fastpath
jest.resetModules();
DependencyGraph = require('../index');
});
afterEach(function() {
process.platform = realPlatform;
});
pit('should get dependencies', function() {
process.platform = 'win32';
it('should get dependencies', function() {
const root = 'C:\\root';
setMockFileSystem({
'root': {
@ -6080,7 +6082,7 @@ describe('DependencyGraph', function() {
});
});
fdescribe('Deterministic order of dependencies', () => {
describe('Deterministic order of dependencies', () => {
let callDeferreds, dependencyGraph, moduleReadDeferreds;
let moduleRead;
let DependencyGraph;