Skip to content

Commit

Permalink
re-enable and fix tests
Browse files Browse the repository at this point in the history
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
  • Loading branch information
davidaurelio authored and Facebook Github Bot 0 committed Sep 3, 2016
1 parent 5ba40fe commit 13994d5
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 18 deletions.
6 changes: 4 additions & 2 deletions Libraries/Network/__tests__/XMLHttpRequest-test.js
Expand Up @@ -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() {},
}
Expand Down
25 changes: 15 additions & 10 deletions Libraries/StyleSheet/__tests__/processColor-test.js
Expand Up @@ -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', () => {

Expand All @@ -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));
});
});

Expand All @@ -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));
});

});
Expand All @@ -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));
});

});
Expand All @@ -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));
});

});
Expand All @@ -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));
});

});
Expand All @@ -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));
});

});
Expand Down
Expand Up @@ -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');
});
Expand Down Expand Up @@ -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': {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 13994d5

Please sign in to comment.