Skip to content

Commit

Permalink
Add test for native module returning enum (facebook#47229)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebook#47229

Adding a test case for an enum value in a fromNative position

Changelog: [Internal]

Reviewed By: makovkastar

Differential Revision: D65038107

fbshipit-source-id: ed323d9a8b226be3ff571c86fda617cabc17cdb9
  • Loading branch information
elicwhite authored and facebook-github-bot committed Oct 28, 2024
1 parent b5b6527 commit 3111473
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,9 @@ const SIMPLE_NATIVE_MODULES: SchemaType = {
typeAnnotation: {
type: 'FunctionTypeAnnotation',
returnTypeAnnotation: {
type: 'StringTypeAnnotation',
name: 'StringEnum',
type: 'EnumDeclaration',
memberType: 'StringTypeAnnotation',
},
params: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@ export type CustomDeviceEvent = {
export interface Spec extends TurboModule {
+getCallback: () => () => void;
+getMixed: (arg: mixed) => mixed;
+getEnums: (quality: Quality, resolution?: Resolution, stringOptions: StringOptions) => string;
+getEnums: (quality: Quality, resolution?: Resolution, stringOptions: StringOptions) => Quality;
+getBinaryTreeNode: (arg: BinaryTreeNode) => BinaryTreeNode;
+getGraphNode: (arg: GraphNode) => GraphNode;
+getMap: (arg: {[a: string]: ?number}) => {[b: string]: ?number};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,9 @@ exports[`RN Codegen Flow Parser can generate fixture CXX_ONLY_NATIVE_MODULE 1`]
'typeAnnotation': {
'type': 'FunctionTypeAnnotation',
'returnTypeAnnotation': {
'type': 'StringTypeAnnotation'
'name': 'Quality',
'type': 'EnumDeclaration',
'memberType': 'StringTypeAnnotation'
},
'params': [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@ export type CustomDeviceEvent = {
export interface Spec extends TurboModule {
readonly getCallback: () => () => void;
readonly getMixed: (arg: unknown) => unknown;
readonly getEnums: (quality: Quality, resolution?: Resolution, stringOptions: StringOptions) => string;
readonly getEnums: (quality: Quality, resolution?: Resolution, stringOptions: StringOptions) => Quality;
readonly getBinaryTreeNode: (arg: BinaryTreeNode) => BinaryTreeNode;
readonly getGraphNode: (arg: GraphNode) => GraphNode;
readonly getMap: (arg: {[a: string]: number | null;}) => {[b: string]: number | null;};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,9 @@ exports[`RN Codegen TypeScript Parser can generate fixture CXX_ONLY_NATIVE_MODUL
'typeAnnotation': {
'type': 'FunctionTypeAnnotation',
'returnTypeAnnotation': {
'type': 'StringTypeAnnotation'
'name': 'Quality',
'type': 'EnumDeclaration',
'memberType': 'StringTypeAnnotation'
},
'params': [
{
Expand Down

0 comments on commit 3111473

Please sign in to comment.