Skip to content

Commit cbdf74e

Browse files
author
Christopher J. Brody
committed
test with useCocoapods: true for iOS
(with no generated example) covers extra breaking mutation 1a from PR #81: diff --git a/lib/lib.js b/lib/lib.js index dc7a233..8b0c231 100644 --- a/lib/lib.js +++ b/lib/lib.js @@ -133,41 +133,40 @@ const generateWithOptions = ({ const generateLibraryModule = () => { return fs.ensureDir(moduleName).then(() => { return Promise.all(templates.filter((template) => { if (template.platform) { return (platforms.indexOf(template.platform) >= 0); } return true; }).map((template) => { const templateArgs = { name: className, moduleName, packageIdentifier, namespace, platforms, githubAccount, authorName, authorEmail, license, view, - useCocoapods, generateExample, exampleName, }; return renderTemplateIfValid(fs, moduleName, template, templateArgs); })); }); }; // This separate promise makes it easier to generate // multiple test or sample apps in the future. const generateExampleApp = () => { const exampleReactNativeInitCommand = `react-native init ${exampleName} --version ${exampleReactNativeVersion}`; console.info( `CREATE example app with the following command: ${exampleReactNativeInitCommand}`); const execOptions = { cwd: `./${moduleName}`, stdio: 'inherit' };
1 parent cf8c1c6 commit cbdf74e

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

tests/with-injection/create/with-options/for-ios/__snapshots__/create-with-options-for-ios.test.js.snap

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ Pod::Spec.new do |s|
183183
s.requires_arc = true
184184
185185
s.dependency \\"React\\"
186-
186+
s.dependency 'AFNetworking', '~> 3.0'
187187
# s.dependency \\"...\\"
188188
end
189189
@@ -206,6 +206,7 @@ content:
206206
--------
207207
#import \\"AliceBobbi.h\\"
208208
209+
#import <AFNetworking/AFNetworking.h>
209210
210211
@implementation AliceBobbi
211212
@@ -214,7 +215,13 @@ RCT_EXPORT_MODULE()
214215
RCT_EXPORT_METHOD(sampleMethod:(NSString *)stringArgument numberParameter:(nonnull NSNumber *)numberArgument callback:(RCTResponseSenderBlock)callback)
215216
{
216217
// TODO: Implement some actually useful functionality
217-
callback(@[[NSString stringWithFormat: @\\"numberArgument: %@ stringArgument: %@\\", numberArgument, stringArgument]]);
218+
AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
219+
manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@\\"text/plain\\"];
220+
[manager GET:@\\"https://httpstat.us/200\\" parameters:nil progress:nil success:^(NSURLSessionTask *task, id responseObject) {
221+
callback(@[[NSString stringWithFormat: @\\"numberArgument: %@ stringArgument: %@ resp: %@\\", numberArgument, stringArgument, responseObject]]);
222+
} failure:^(NSURLSessionTask *operation, NSError *error) {
223+
callback(@[[NSString stringWithFormat: @\\"numberArgument: %@ stringArgument: %@ err: %@\\", numberArgument, stringArgument, error]]);
224+
}];
218225
}
219226
220227
@end

tests/with-injection/create/with-options/for-ios/create-with-options-for-ios.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ test('create alice-bobbi module with config options for iOS only', () => {
1414
authorName: 'Alice',
1515
authorEmail: '[email protected]',
1616
license: 'ISC',
17+
useCocoapods: true
1718
};
1819

1920
return lib(options, inject)

0 commit comments

Comments
 (0)