|
1 | 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP |
2 | 2 |
|
| 3 | +exports[`Babel plugin inline view configs can inline config for CommandsWithComplexCoverageNativeComponent.js 1`] = ` |
| 4 | +"// @flow |
| 5 | +
|
| 6 | +const codegenNativeCommands = require('codegenNativeCommands'); |
| 7 | +const codegenNativeComponent = require('codegenNativeComponent'); |
| 8 | +import type { ViewProps } from 'ViewPropTypes'; |
| 9 | +import type { NativeComponentType } from 'codegenNativeComponent'; |
| 10 | +type ModuleProps = $ReadOnly<{| |
| 11 | + ...ViewProps |
| 12 | +|}>; |
| 13 | +type NativeType = NativeComponentType<ModuleProps>; |
| 14 | +interface NativeCommands { |
| 15 | + +seek: (viewRef: React.ElementRef<NativeType>, position: number) => void, |
| 16 | + +stop: (viewRef: React.ElementRef<NativeType>) => void, |
| 17 | +} |
| 18 | +const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/NativeComponentRegistry'); |
| 19 | +let nativeComponentName = 'Module'; |
| 20 | +export const __INTERNAL_VIEW_CONFIG = { |
| 21 | + uiViewClassName: \\"Module\\", |
| 22 | + validAttributes: {} |
| 23 | +}; |
| 24 | +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG);" |
| 25 | +`; |
| 26 | +
|
| 27 | +exports[`Babel plugin inline view configs can inline config for CommandsWithSimpleCoverageNativeComponent.js 1`] = ` |
| 28 | +"// @flow |
| 29 | +
|
| 30 | +const codegenNativeCommands = require('codegenNativeCommands'); |
| 31 | +const codegenNativeComponent = require('codegenNativeComponent'); |
| 32 | +import type { ViewProps } from 'ViewPropTypes'; |
| 33 | +import type { NativeComponentType } from 'codegenNativeComponent'; |
| 34 | +type ModuleProps = $ReadOnly<{| |
| 35 | + ...ViewProps |
| 36 | +|}>; |
| 37 | +type NativeType = NativeComponentType<ModuleProps>; |
| 38 | +interface NativeCommands { |
| 39 | + +pause: (viewRef: React.ElementRef<NativeType>) => void, |
| 40 | + +play: (viewRef: React.ElementRef<NativeType>) => void, |
| 41 | +} |
| 42 | +const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/NativeComponentRegistry'); |
| 43 | +let nativeComponentName = 'Module'; |
| 44 | +export const __INTERNAL_VIEW_CONFIG = { |
| 45 | + uiViewClassName: \\"Module\\", |
| 46 | + validAttributes: {} |
| 47 | +}; |
| 48 | +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG);" |
| 49 | +`; |
| 50 | +
|
| 51 | +exports[`Babel plugin inline view configs can inline config for CommandsWithTypeCastCoverageNativeComponent.js 1`] = ` |
| 52 | +"// @flow |
| 53 | +
|
| 54 | +const codegenNativeCommands = require('codegenNativeCommands'); |
| 55 | +const codegenNativeComponent = require('codegenNativeComponent'); |
| 56 | +import type { ViewProps } from 'ViewPropTypes'; |
| 57 | +import type { NativeComponentType } from 'codegenNativeComponent'; |
| 58 | +type ModuleProps = $ReadOnly<{| |
| 59 | + ...ViewProps |
| 60 | +|}>; |
| 61 | +type NativeType = NativeComponentType<ModuleProps>; |
| 62 | +interface NativeCommands { |
| 63 | + +mute: (viewRef: React.ElementRef<NativeType>) => void, |
| 64 | + +unmute: (viewRef: React.ElementRef<NativeType>) => void, |
| 65 | +} |
| 66 | +const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/NativeComponentRegistry'); |
| 67 | +let nativeComponentName = 'Module'; |
| 68 | +export const __INTERNAL_VIEW_CONFIG = { |
| 69 | + uiViewClassName: \\"Module\\", |
| 70 | + validAttributes: {} |
| 71 | +}; |
| 72 | +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG);" |
| 73 | +`; |
| 74 | +
|
3 | 75 | exports[`Babel plugin inline view configs can inline config for FullNativeComponent.js 1`] = ` |
4 | 76 | "// @flow |
5 | 77 |
|
@@ -153,6 +225,61 @@ exports[`Babel plugin inline view configs fails on inline config for CommandsExp |
153 | 225 | 24 |" |
154 | 226 | `; |
155 | 227 |
|
| 228 | +exports[`Babel plugin inline view configs fails on inline config for CommandsWithComplexCoverageInvalidNativeComponent.js 1`] = ` |
| 229 | +"/CommandsWithComplexCoverageInvalidNativeComponent.js: 'Commands' is a reserved export and may only be used to export the result of codegenNativeCommands. |
| 230 | + 14 | |
| 231 | + 15 | // Complex coverage instrumentation with invalid nested structure - should fail |
| 232 | +> 16 | export const Commands = ( |
| 233 | + | ^ |
| 234 | + 17 | cov_xyz789().f[1]++, |
| 235 | + 18 | cov_xyz789().s[2]++, |
| 236 | + 19 | {" |
| 237 | +`; |
| 238 | +
|
| 239 | +exports[`Babel plugin inline view configs fails on inline config for CommandsWithCoverageInvalidNativeComponent.js 1`] = ` |
| 240 | +"/CommandsWithCoverageInvalidNativeComponent.js: 'Commands' is a reserved export and may only be used to export the result of codegenNativeCommands. |
| 241 | + 14 | |
| 242 | + 15 | // Coverage instrumentation of invalid Commands export - should still fail |
| 243 | +> 16 | export const Commands = (cov_1234567890().s[0]++, { |
| 244 | + | ^ |
| 245 | + 17 | hotspotUpdate: () => {}, |
| 246 | + 18 | scrollTo: () => {}, |
| 247 | + 19 | });" |
| 248 | +`; |
| 249 | +
|
| 250 | +exports[`Babel plugin inline view configs fails on inline config for CommandsWithCoverageTypeCastInvalidNativeComponent.js 1`] = ` |
| 251 | +"/CommandsWithCoverageTypeCastInvalidNativeComponent.js: 'Commands' is a reserved export and may only be used to export the result of codegenNativeCommands. |
| 252 | + 19 | |
| 253 | + 20 | // Coverage instrumentation with type cast but wrong function - should fail |
| 254 | +> 21 | export const Commands: NativeCommands = (cov_cast123().s[0]++, invalidFunction({ |
| 255 | + | ^ |
| 256 | + 22 | supportedCommands: ['pause', 'play'], |
| 257 | + 23 | })); |
| 258 | + 24 |" |
| 259 | +`; |
| 260 | +
|
| 261 | +exports[`Babel plugin inline view configs fails on inline config for CommandsWithCoverageWrongFunctionNativeComponent.js 1`] = ` |
| 262 | +"/CommandsWithCoverageWrongFunctionNativeComponent.js: 'Commands' is a reserved export and may only be used to export the result of codegenNativeCommands. |
| 263 | + 14 | |
| 264 | + 15 | // Coverage instrumentation of wrong function call - should fail |
| 265 | +> 16 | export const Commands = (cov_abcdef123().s[0]++, someOtherFunction({ |
| 266 | + | ^ |
| 267 | + 17 | supportedCommands: ['pause', 'play'], |
| 268 | + 18 | })); |
| 269 | + 19 |" |
| 270 | +`; |
| 271 | +
|
| 272 | +exports[`Babel plugin inline view configs fails on inline config for CommandsWithCoverageWrongNameNativeComponent.js 1`] = ` |
| 273 | +"/CommandsWithCoverageWrongNameNativeComponent.js: Native commands must be exported with the name 'Commands' |
| 274 | + 20 | |
| 275 | + 21 | // Coverage instrumentation with correct function but wrong export name - should fail |
| 276 | +> 22 | export const WrongName = (cov_wrong123().s[0]++, codegenNativeCommands<NativeCommands>({ |
| 277 | + | ^ |
| 278 | + 23 | supportedCommands: ['pause', 'play'], |
| 279 | + 24 | })); |
| 280 | + 25 |" |
| 281 | +`; |
| 282 | +
|
156 | 283 | exports[`Babel plugin inline view configs fails on inline config for OtherCommandsExportNativeComponent.js 1`] = ` |
157 | 284 | "/OtherCommandsExportNativeComponent.js: 'Commands' is a reserved export and may only be used to export the result of codegenNativeCommands. |
158 | 285 | 17 | } |
|
0 commit comments