Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

11 changes: 5 additions & 6 deletions tests/init-with-example/init-with-example-with-log.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,11 @@ jest.mock('console', () => ({
}
}))

jest.mock('prompts', () => args => {
expect(Array.isArray(args)).toBe(true)
mockCallSnapshot.push({ prompts: { args } })
const optionsArray = [].concat(args)
expect(optionsArray.length).toBe(1)
return Promise.resolve(mockPromptResponses[optionsArray[0].name])
jest.mock('prompts', () => prompts => {
expect(Array.isArray(prompts)).toBe(true)
expect(prompts.length).toBe(1)
mockCallSnapshot.push({ prompts })
return Promise.resolve(mockPromptResponses[prompts[0].name])
})

jest.mock('execa', () => (cmd, args, opts) => {
Expand Down
322 changes: 147 additions & 175 deletions tests/no-example/__snapshots__/no-example-with-log.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -10,142 +10,124 @@ Array [
],
},
Object {
"prompts": Object {
"args": Array [
Object {
"message": "What is the desired native module name?",
"name": "nativeModuleNameInput",
"onState": [Function],
"type": "text",
"validate": [Function],
},
],
},
"prompts": Array [
Object {
"message": "What is the desired native module name?",
"name": "nativeModuleNameInput",
"onState": [Function],
"type": "text",
"validate": [Function],
},
],
},
Object {
"prompts": Object {
"args": Array [
Object {
"active": "yes",
"inactive": "no",
"initial": false,
"message": "Should it be a view?",
"name": "isView",
"onState": [Function],
"type": "toggle",
},
],
},
"prompts": Array [
Object {
"active": "yes",
"inactive": "no",
"initial": false,
"message": "Should it be a view?",
"name": "isView",
"onState": [Function],
"type": "toggle",
},
],
},
Object {
"prompts": Object {
"args": Array [
Object {
"initial": "react-native-test-module",
"message": "What is the full module package name?",
"name": "modulePackageName",
"onState": [Function],
"type": "text",
"validate": [Function],
},
],
},
"prompts": Array [
Object {
"initial": "react-native-test-module",
"message": "What is the full module package name?",
"name": "modulePackageName",
"onState": [Function],
"type": "text",
"validate": [Function],
},
],
},
Object {
"prompts": Object {
"args": Array [
Object {
"initial": true,
"message": "Initial package version is 1.0.0 - continue?",
"name": "confirmation",
"onState": [Function],
"type": "confirm",
},
],
},
"prompts": Array [
Object {
"initial": true,
"message": "Initial package version is 1.0.0 - continue?",
"name": "confirmation",
"onState": [Function],
"type": "confirm",
},
],
},
Object {
"prompts": Object {
"args": Array [
Object {
"initial": "",
"message": "What is the desired native object class name prefix (can be blank)?",
"name": "nativeObjectClassNamePrefixInput",
"onState": [Function],
"type": "text",
},
],
},
"prompts": Array [
Object {
"initial": "",
"message": "What is the desired native object class name prefix (can be blank)?",
"name": "nativeObjectClassNamePrefixInput",
"onState": [Function],
"type": "text",
},
],
},
Object {
"prompts": Object {
"args": Array [
Object {
"initial": true,
"message": "Native class name is NATIVETestModule. Continue?",
"name": "confirmation",
"onState": [Function],
"type": "confirm",
},
],
},
"prompts": Array [
Object {
"initial": true,
"message": "Native class name is NATIVETestModule. Continue?",
"name": "confirmation",
"onState": [Function],
"type": "confirm",
},
],
},
Object {
"prompts": Object {
"args": Array [
Object {
"choices": Array [
Object {
"selected": true,
"title": "Android",
"value": "android",
},
Object {
"selected": true,
"title": "iOS",
"value": "ios",
},
Object {
"disabled": true,
"title": "Windows",
"value": "windows",
},
],
"message": "Which native platforms?",
"min": 1,
"name": "platforms",
"onState": [Function],
"type": "multiselect",
},
],
},
"prompts": Array [
Object {
"choices": Array [
Object {
"selected": true,
"title": "Android",
"value": "android",
},
Object {
"selected": true,
"title": "iOS",
"value": "ios",
},
Object {
"disabled": true,
"title": "Windows",
"value": "windows",
},
],
"message": "Which native platforms?",
"min": 1,
"name": "platforms",
"onState": [Function],
"type": "multiselect",
},
],
},
Object {
"prompts": Object {
"args": Array [
Object {
"initial": "com.demo",
"message": "What is the desired Android package id?",
"name": "androidPackageId",
"onState": [Function],
"type": "text",
"validate": [Function],
},
],
},
"prompts": Array [
Object {
"initial": "com.demo",
"message": "What is the desired Android package id?",
"name": "androidPackageId",
"onState": [Function],
"type": "text",
"validate": [Function],
},
],
},
Object {
"prompts": Object {
"args": Array [
Object {
"initial": false,
"message": "Support Apple tvOS (requires react-native-tvos fork)?",
"name": "tvosEnabled",
"onState": [Function],
"type": "confirm",
},
],
},
"prompts": Array [
Object {
"initial": false,
"message": "Support Apple tvOS (requires react-native-tvos fork)?",
"name": "tvosEnabled",
"onState": [Function],
"type": "confirm",
},
],
},
Object {
"execa": Array [
Expand All @@ -168,56 +150,48 @@ Array [
],
},
Object {
"prompts": Object {
"args": Array [
Object {
"initial": "Alice",
"message": "What is the author name?",
"name": "authorName",
"onState": [Function],
"type": "text",
},
],
},
"prompts": Array [
Object {
"initial": "Alice",
"message": "What is the author name?",
"name": "authorName",
"onState": [Function],
"type": "text",
},
],
},
Object {
"prompts": Object {
"args": Array [
Object {
"initial": "[email protected]",
"message": "What is the author email?",
"name": "authorEmail",
"onState": [Function],
"type": "text",
},
],
},
"prompts": Array [
Object {
"initial": "[email protected]",
"message": "What is the author email?",
"name": "authorEmail",
"onState": [Function],
"type": "text",
},
],
},
Object {
"prompts": Object {
"args": Array [
Object {
"initial": "ada",
"message": "What is the GitHub user account name?",
"name": "githubUserAccountName",
"onState": [Function],
"type": "text",
},
],
},
"prompts": Array [
Object {
"initial": "ada",
"message": "What is the GitHub user account name?",
"name": "githubUserAccountName",
"onState": [Function],
"type": "text",
},
],
},
Object {
"prompts": Object {
"args": Array [
Object {
"initial": "MIT",
"message": "What license?",
"name": "license",
"onState": [Function],
"type": "text",
},
],
},
"prompts": Array [
Object {
"initial": "MIT",
"message": "What license?",
"name": "license",
"onState": [Function],
"type": "text",
},
],
},
Object {
"log": Array [
Expand All @@ -238,17 +212,15 @@ Array [
],
},
Object {
"prompts": Object {
"args": Array [
Object {
"initial": true,
"message": "Generate the example app (with workarounds in metro.config.js)?",
"name": "generateExampleApp",
"onState": [Function],
"type": "confirm",
},
],
},
"prompts": Array [
Object {
"initial": true,
"message": "Generate the example app (with workarounds in metro.config.js)?",
"name": "generateExampleApp",
"onState": [Function],
"type": "confirm",
},
],
},
Object {
"log": Array [
Expand Down
Loading