Merge pull request #3000 from foghina/fix_yeoman_tests

[cli] use different names in generator tests

This should fix #2974
This commit is contained in:
Felix Oghină 2015-09-24 13:57:12 +01:00
commit 9f1ff48458
3 changed files with 45 additions and 36 deletions

View File

@ -71,8 +71,6 @@ env:
- TEST_TYPE=cli - TEST_TYPE=cli
- TEST_TYPE=build_website - TEST_TYPE=build_website
- TEST_TYPE=e2e - TEST_TYPE=e2e
allow_failures:
- TEST_TYPE=cli
global: global:
- secure: "HlmG8M2DmBUSBh6KH1yVIe/8gR4iibg4WfcHq1x/xYQxGbvleq7NOo04V6eFHnl9cvZCu+PKH0841WLnGR7c4BBf47GVu/o16nXzggPumHKy++lDzxFPlJ1faMDfjg/5vjbAxRUe7D3y98hQSeGHH4tedc8LvTaFLVu7iiGqvjU=" - secure: "HlmG8M2DmBUSBh6KH1yVIe/8gR4iibg4WfcHq1x/xYQxGbvleq7NOo04V6eFHnl9cvZCu+PKH0841WLnGR7c4BBf47GVu/o16nXzggPumHKy++lDzxFPlJ1faMDfjg/5vjbAxRUe7D3y98hQSeGHH4tedc8LvTaFLVu7iiGqvjU="

View File

@ -5,15 +5,26 @@ jest.autoMockOff();
var path = require('path'); var path = require('path');
describe('react:android', function () { describe('react:android', function () {
var assert = require('yeoman-generator').assert; var assert;
beforeEach(function (done) { beforeEach(function (done) {
// A deep dependency of yeoman spams console.log with giant json objects.
// yeoman-generator/node_modules/
// download/node_modules/
// caw/node_modules/
// get-proxy/node_modules/
// rc/index.js
var log = console.log;
console.log = function() {};
assert = require('yeoman-generator').assert;
var helpers = require('yeoman-generator').test; var helpers = require('yeoman-generator').test;
console.log = log;
var generated = false; var generated = false;
runs(function() { runs(function() {
helpers.run(path.resolve(__dirname, '..', 'generator-android')) helpers.run(path.resolve(__dirname, '..', 'generator-android'))
.withArguments(['TestApp']) .withArguments(['TestAppAndroid'])
.withOptions({ .withOptions({
'package': 'com.reactnative.test', 'package': 'com.reactnative.test',
}) })
@ -67,11 +78,11 @@ describe('react:android', function () {
); );
assert.fileContent( assert.fileContent(
path.join('android', 'app', 'src', 'main', 'java', 'com', 'reactnative', 'test', 'MainActivity.java'), path.join('android', 'app', 'src', 'main', 'java', 'com', 'reactnative', 'test', 'MainActivity.java'),
'mReactRootView.startReactApplication(mReactInstanceManager, "TestApp", null);' 'mReactRootView.startReactApplication(mReactInstanceManager, "TestAppAndroid", null);'
); );
assert.fileContent( assert.fileContent(
path.join('android', 'app', 'src', 'main', 'res', 'values', 'strings.xml'), path.join('android', 'app', 'src', 'main', 'res', 'values', 'strings.xml'),
'<string name="app_name">TestApp</string>' '<string name="app_name">TestAppAndroid</string>'
); );
}); });
}); });

View File

@ -24,7 +24,7 @@ describe('react:ios', function() {
runs(function() { runs(function() {
helpers.run(path.resolve(__dirname, '../generator-ios')) helpers.run(path.resolve(__dirname, '../generator-ios'))
.withArguments(['TestApp']) .withArguments(['TestAppIOS'])
.on('end', function() { .on('end', function() {
generated = true; generated = true;
}); });
@ -40,58 +40,58 @@ describe('react:ios', function() {
it('creates files', function() { it('creates files', function() {
assert.file([ assert.file([
'ios/main.jsbundle', 'ios/main.jsbundle',
'ios/TestApp/AppDelegate.h', 'ios/TestAppIOS/AppDelegate.h',
'ios/TestApp/AppDelegate.m', 'ios/TestAppIOS/AppDelegate.m',
'ios/TestApp/Base.lproj/LaunchScreen.xib', 'ios/TestAppIOS/Base.lproj/LaunchScreen.xib',
'ios/TestApp/Images.xcassets/AppIcon.appiconset/Contents.json', 'ios/TestAppIOS/Images.xcassets/AppIcon.appiconset/Contents.json',
'ios/TestApp/Info.plist', 'ios/TestAppIOS/Info.plist',
'ios/TestApp/main.m', 'ios/TestAppIOS/main.m',
'ios/TestApp.xcodeproj/project.pbxproj', 'ios/TestAppIOS.xcodeproj/project.pbxproj',
'ios/TestApp.xcodeproj/xcshareddata/xcschemes/TestApp.xcscheme', 'ios/TestAppIOS.xcodeproj/xcshareddata/xcschemes/TestAppIOS.xcscheme',
'ios/TestAppTests/TestAppTests.m', 'ios/TestAppIOSTests/TestAppIOSTests.m',
'ios/TestAppTests/Info.plist' 'ios/TestAppIOSTests/Info.plist'
]); ]);
}); });
it('replaces vars in AppDelegate.m', function() { it('replaces vars in AppDelegate.m', function() {
var appDelegate = 'ios/TestApp/AppDelegate.m'; var appDelegate = 'ios/TestAppIOS/AppDelegate.m';
assert.fileContent(appDelegate, 'moduleName:@"TestApp"'); assert.fileContent(appDelegate, 'moduleName:@"TestAppIOS"');
assert.noFileContent(appDelegate, 'SampleApp'); assert.noFileContent(appDelegate, 'SampleApp');
}); });
it('replaces vars in LaunchScreen.xib', function() { it('replaces vars in LaunchScreen.xib', function() {
var launchScreen = 'ios/TestApp/Base.lproj/LaunchScreen.xib'; var launchScreen = 'ios/TestAppIOS/Base.lproj/LaunchScreen.xib';
assert.fileContent(launchScreen, 'text="TestApp"'); assert.fileContent(launchScreen, 'text="TestAppIOS"');
assert.noFileContent(launchScreen, 'SampleApp'); assert.noFileContent(launchScreen, 'SampleApp');
}); });
it('replaces vars in TestAppTests.m', function() { it('replaces vars in TestAppIOSTests.m', function() {
var tests = 'ios/TestAppTests/TestAppTests.m'; var tests = 'ios/TestAppIOSTests/TestAppIOSTests.m';
assert.fileContent(tests, '@interface TestAppTests : XCTestCase'); assert.fileContent(tests, '@interface TestAppIOSTests : XCTestCase');
assert.fileContent(tests, '@implementation TestAppTests'); assert.fileContent(tests, '@implementation TestAppIOSTests');
assert.noFileContent(tests, 'SampleApp'); assert.noFileContent(tests, 'SampleApp');
}); });
it('replaces vars in project.pbxproj', function() { it('replaces vars in project.pbxproj', function() {
var pbxproj = 'ios/TestApp.xcodeproj/project.pbxproj'; var pbxproj = 'ios/TestAppIOS.xcodeproj/project.pbxproj';
assert.fileContent(pbxproj, '"TestApp"'); assert.fileContent(pbxproj, '"TestAppIOS"');
assert.fileContent(pbxproj, '"TestAppTests"'); assert.fileContent(pbxproj, '"TestAppIOSTests"');
assert.fileContent(pbxproj, 'TestApp.app'); assert.fileContent(pbxproj, 'TestAppIOS.app');
assert.fileContent(pbxproj, 'TestAppTests.xctest'); assert.fileContent(pbxproj, 'TestAppIOSTests.xctest');
assert.noFileContent(pbxproj, 'SampleApp'); assert.noFileContent(pbxproj, 'SampleApp');
}); });
it('replaces vars in xcscheme', function() { it('replaces vars in xcscheme', function() {
var xcscheme = 'ios/TestApp.xcodeproj/xcshareddata/xcschemes/TestApp.xcscheme'; var xcscheme = 'ios/TestAppIOS.xcodeproj/xcshareddata/xcschemes/TestAppIOS.xcscheme';
assert.fileContent(xcscheme, '"TestApp"'); assert.fileContent(xcscheme, '"TestAppIOS"');
assert.fileContent(xcscheme, '"TestApp.app"'); assert.fileContent(xcscheme, '"TestAppIOS.app"');
assert.fileContent(xcscheme, 'TestApp.xcodeproj'); assert.fileContent(xcscheme, 'TestAppIOS.xcodeproj');
assert.fileContent(xcscheme, '"TestAppTests.xctest"'); assert.fileContent(xcscheme, '"TestAppIOSTests.xctest"');
assert.fileContent(xcscheme, '"TestAppTests"'); assert.fileContent(xcscheme, '"TestAppIOSTests"');
assert.noFileContent(xcscheme, 'SampleApp'); assert.noFileContent(xcscheme, 'SampleApp');
}); });