Migrate unit tests from FBReactKitModules to FBReactKit

This commit is contained in:
Nick Lockwood
2015-07-07 16:19:40 -07:00
parent 5c01b1e1a0
commit 1b7699f671
24 changed files with 93 additions and 49 deletions

View File

@@ -14,11 +14,11 @@
#import "RCTAssert.h"
@interface IntegrationTestsTests : XCTestCase
@interface IntegrationTests : XCTestCase
@end
@implementation IntegrationTestsTests
@implementation IntegrationTests
{
RCTTestRunner *_runner;
}
@@ -31,7 +31,7 @@
NSOperatingSystemVersion version = [[NSProcessInfo processInfo] operatingSystemVersion];
RCTAssert(version.majorVersion == 8 || version.minorVersion == 3, @"Tests should be run on iOS 8.3, found %zd.%zd.%zd", version.majorVersion, version.minorVersion, version.patchVersion);
_runner = RCTInitRunnerForApp(@"Examples/UIExplorer/UIExplorerIntegrationTests/js/IntegrationTestsApp");
_runner = RCTInitRunnerForApp(@"Examples/UIExplorer/UIExplorerIntegrationTests/js/IntegrationTestsApp", nil);
}
#pragma mark Logic Tests

View File

@@ -21,14 +21,14 @@
#import "RCTRedBox.h"
#import "RCTRootView.h"
@interface UIExplorerTests : XCTestCase
@interface UIExplorerSnapshotTests : XCTestCase
{
RCTTestRunner *_runner;
}
@end
@implementation UIExplorerTests
@implementation UIExplorerSnapshotTests
- (void)setUp
{
@@ -37,21 +37,26 @@
#endif
NSString *version = [[UIDevice currentDevice] systemVersion];
RCTAssert([version isEqualToString:@"8.3"], @"Snapshot tests should be run on iOS 8.3, found %@", version);
_runner = RCTInitRunnerForApp(@"Examples/UIExplorer/UIExplorerApp.ios");
_runner = RCTInitRunnerForApp(@"Examples/UIExplorer/UIExplorerApp.ios", nil);
_runner.recordMode = NO;
}
#define RCT_SNAPSHOT_TEST(name, reRecord) \
- (void)test##name##Snapshot \
{ \
_runner.recordMode |= reRecord; \
[_runner runTest:_cmd module:@#name]; \
#define RCT_TEST(name) \
- (void)test##name \
{ \
[_runner runTest:_cmd module:@#name]; \
}
RCT_SNAPSHOT_TEST(ViewExample, NO)
RCT_SNAPSHOT_TEST(LayoutExample, NO)
RCT_SNAPSHOT_TEST(TextExample, NO)
RCT_SNAPSHOT_TEST(SwitchExample, NO)
RCT_SNAPSHOT_TEST(SliderExample, NO)
RCT_SNAPSHOT_TEST(TabBarExample, NO)
RCT_TEST(ViewExample)
RCT_TEST(LayoutExample)
RCT_TEST(TextExample)
RCT_TEST(SwitchExample)
RCT_TEST(SliderExample)
RCT_TEST(TabBarExample)
- (void)testZZZNotInRecordMode
{
XCTAssertFalse(_runner.recordMode, @"Don't forget to turn record mode back to off");
}
@end

View File

@@ -53,7 +53,7 @@ var IntegrationTestsApp = React.createClass({
<View style={styles.container}>
<Text style={styles.row}>
Click on a test to run it in this shell for easier debugging and
development. Run all tests in the testing envirnment with cmd+U in
development. Run all tests in the testing environment with cmd+U in
Xcode.
</Text>
<View style={styles.separator} />

View File

@@ -121,7 +121,7 @@ var LayoutEventsTest = React.createClass({
ref="img"
onLayout={this.onImageLayout}
style={styles.image}
source={{uri: 'https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/t39.1997/p128x128/851561_767334496626293_1958532586_n.png'}}
source={{uri: 'uie_thumb_big.png'}}
/>
<Text>
ViewLayout: {JSON.stringify(this.state.viewLayout, null, ' ') + '\n\n'}