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:
commit
9f1ff48458
|
@ -71,8 +71,6 @@ env:
|
|||
- TEST_TYPE=cli
|
||||
- TEST_TYPE=build_website
|
||||
- TEST_TYPE=e2e
|
||||
allow_failures:
|
||||
- TEST_TYPE=cli
|
||||
global:
|
||||
- secure: "HlmG8M2DmBUSBh6KH1yVIe/8gR4iibg4WfcHq1x/xYQxGbvleq7NOo04V6eFHnl9cvZCu+PKH0841WLnGR7c4BBf47GVu/o16nXzggPumHKy++lDzxFPlJ1faMDfjg/5vjbAxRUe7D3y98hQSeGHH4tedc8LvTaFLVu7iiGqvjU="
|
||||
|
||||
|
|
|
@ -5,15 +5,26 @@ jest.autoMockOff();
|
|||
var path = require('path');
|
||||
|
||||
describe('react:android', function () {
|
||||
var assert = require('yeoman-generator').assert;
|
||||
var assert;
|
||||
|
||||
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;
|
||||
console.log = log;
|
||||
|
||||
var generated = false;
|
||||
|
||||
runs(function() {
|
||||
helpers.run(path.resolve(__dirname, '..', 'generator-android'))
|
||||
.withArguments(['TestApp'])
|
||||
.withArguments(['TestAppAndroid'])
|
||||
.withOptions({
|
||||
'package': 'com.reactnative.test',
|
||||
})
|
||||
|
@ -67,11 +78,11 @@ describe('react:android', function () {
|
|||
);
|
||||
assert.fileContent(
|
||||
path.join('android', 'app', 'src', 'main', 'java', 'com', 'reactnative', 'test', 'MainActivity.java'),
|
||||
'mReactRootView.startReactApplication(mReactInstanceManager, "TestApp", null);'
|
||||
'mReactRootView.startReactApplication(mReactInstanceManager, "TestAppAndroid", null);'
|
||||
);
|
||||
assert.fileContent(
|
||||
path.join('android', 'app', 'src', 'main', 'res', 'values', 'strings.xml'),
|
||||
'<string name="app_name">TestApp</string>'
|
||||
'<string name="app_name">TestAppAndroid</string>'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -24,7 +24,7 @@ describe('react:ios', function() {
|
|||
|
||||
runs(function() {
|
||||
helpers.run(path.resolve(__dirname, '../generator-ios'))
|
||||
.withArguments(['TestApp'])
|
||||
.withArguments(['TestAppIOS'])
|
||||
.on('end', function() {
|
||||
generated = true;
|
||||
});
|
||||
|
@ -40,58 +40,58 @@ describe('react:ios', function() {
|
|||
it('creates files', function() {
|
||||
assert.file([
|
||||
'ios/main.jsbundle',
|
||||
'ios/TestApp/AppDelegate.h',
|
||||
'ios/TestApp/AppDelegate.m',
|
||||
'ios/TestApp/Base.lproj/LaunchScreen.xib',
|
||||
'ios/TestApp/Images.xcassets/AppIcon.appiconset/Contents.json',
|
||||
'ios/TestApp/Info.plist',
|
||||
'ios/TestApp/main.m',
|
||||
'ios/TestApp.xcodeproj/project.pbxproj',
|
||||
'ios/TestApp.xcodeproj/xcshareddata/xcschemes/TestApp.xcscheme',
|
||||
'ios/TestAppTests/TestAppTests.m',
|
||||
'ios/TestAppTests/Info.plist'
|
||||
'ios/TestAppIOS/AppDelegate.h',
|
||||
'ios/TestAppIOS/AppDelegate.m',
|
||||
'ios/TestAppIOS/Base.lproj/LaunchScreen.xib',
|
||||
'ios/TestAppIOS/Images.xcassets/AppIcon.appiconset/Contents.json',
|
||||
'ios/TestAppIOS/Info.plist',
|
||||
'ios/TestAppIOS/main.m',
|
||||
'ios/TestAppIOS.xcodeproj/project.pbxproj',
|
||||
'ios/TestAppIOS.xcodeproj/xcshareddata/xcschemes/TestAppIOS.xcscheme',
|
||||
'ios/TestAppIOSTests/TestAppIOSTests.m',
|
||||
'ios/TestAppIOSTests/Info.plist'
|
||||
]);
|
||||
});
|
||||
|
||||
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');
|
||||
});
|
||||
|
||||
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');
|
||||
});
|
||||
|
||||
it('replaces vars in TestAppTests.m', function() {
|
||||
var tests = 'ios/TestAppTests/TestAppTests.m';
|
||||
it('replaces vars in TestAppIOSTests.m', function() {
|
||||
var tests = 'ios/TestAppIOSTests/TestAppIOSTests.m';
|
||||
|
||||
assert.fileContent(tests, '@interface TestAppTests : XCTestCase');
|
||||
assert.fileContent(tests, '@implementation TestAppTests');
|
||||
assert.fileContent(tests, '@interface TestAppIOSTests : XCTestCase');
|
||||
assert.fileContent(tests, '@implementation TestAppIOSTests');
|
||||
assert.noFileContent(tests, 'SampleApp');
|
||||
});
|
||||
|
||||
it('replaces vars in project.pbxproj', function() {
|
||||
var pbxproj = 'ios/TestApp.xcodeproj/project.pbxproj';
|
||||
assert.fileContent(pbxproj, '"TestApp"');
|
||||
assert.fileContent(pbxproj, '"TestAppTests"');
|
||||
assert.fileContent(pbxproj, 'TestApp.app');
|
||||
assert.fileContent(pbxproj, 'TestAppTests.xctest');
|
||||
var pbxproj = 'ios/TestAppIOS.xcodeproj/project.pbxproj';
|
||||
assert.fileContent(pbxproj, '"TestAppIOS"');
|
||||
assert.fileContent(pbxproj, '"TestAppIOSTests"');
|
||||
assert.fileContent(pbxproj, 'TestAppIOS.app');
|
||||
assert.fileContent(pbxproj, 'TestAppIOSTests.xctest');
|
||||
|
||||
assert.noFileContent(pbxproj, 'SampleApp');
|
||||
});
|
||||
|
||||
it('replaces vars in xcscheme', function() {
|
||||
var xcscheme = 'ios/TestApp.xcodeproj/xcshareddata/xcschemes/TestApp.xcscheme';
|
||||
assert.fileContent(xcscheme, '"TestApp"');
|
||||
assert.fileContent(xcscheme, '"TestApp.app"');
|
||||
assert.fileContent(xcscheme, 'TestApp.xcodeproj');
|
||||
assert.fileContent(xcscheme, '"TestAppTests.xctest"');
|
||||
assert.fileContent(xcscheme, '"TestAppTests"');
|
||||
var xcscheme = 'ios/TestAppIOS.xcodeproj/xcshareddata/xcschemes/TestAppIOS.xcscheme';
|
||||
assert.fileContent(xcscheme, '"TestAppIOS"');
|
||||
assert.fileContent(xcscheme, '"TestAppIOS.app"');
|
||||
assert.fileContent(xcscheme, 'TestAppIOS.xcodeproj');
|
||||
assert.fileContent(xcscheme, '"TestAppIOSTests.xctest"');
|
||||
assert.fileContent(xcscheme, '"TestAppIOSTests"');
|
||||
|
||||
assert.noFileContent(xcscheme, 'SampleApp');
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue