Tadeu Zagallo 3bb303e81a [ReactNative] Explictly set displayName on tests
Summary:
@public

For some weird reason sometimes displayName is undefined on the OSS tests, manually
set it for now to unbreak the tests.

Test Plan: Run the tests on OSS
2015-06-23 19:14:55 -08:00

53 lines
1.2 KiB
JavaScript

/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule PromiseTest
*/
'use strict';
var RCTTestModule = require('NativeModules').TestModule;
var React = require('react-native');
var PromiseTest = React.createClass({
shouldResolve: false,
shouldReject: false,
componentDidMount() {
Promise.all([
this.testShouldResolve(),
this.testShouldReject(),
]).then(() => RCTTestModule.markTestPassed(
this.shouldResolve && this.shouldReject
));
},
testShouldResolve() {
return RCTTestModule
.shouldResolve()
.then(() => this.shouldResolve = true)
.catch(() => this.shouldResolve = false);
},
testShouldReject() {
return RCTTestModule
.shouldReject()
.then(() => this.shouldReject = false)
.catch(() => this.shouldReject = true);
},
render() {
return <React.View />;
}
});
PromiseTest.displayName = 'PromiseTest';
module.exports = PromiseTest;