Skip to content

Commit 2b93377

Browse files
sammy-SCfacebook-github-bot
authored andcommitted
add e2e test for AppState module (facebook#49680)
Summary: Pull Request resolved: facebook#49680 changelog: [internal] add an end to end test for AppState module. Reviewed By: rshest Differential Revision: D70184850 fbshipit-source-id: ead1388ceb1018e7615e50f846f3c95224be97d0
1 parent 5fc2484 commit 2b93377

File tree

1 file changed

+11
-17
lines changed

1 file changed

+11
-17
lines changed

packages/rn-tester/js/examples/AppState/AppStateExample.js

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -67,33 +67,23 @@ function AppStateSubscription(props: Props) {
6767
};
6868

6969
if (props.showMemoryWarnings) {
70-
return (
71-
<View>
72-
<RNTesterText>{memoryWarnings}</RNTesterText>
73-
</View>
74-
);
70+
return <RNTesterText>{memoryWarnings}</RNTesterText>;
7571
}
7672

7773
if (props.showCurrentOnly) {
7874
return (
79-
<View>
80-
<RNTesterText>{currentAppState}</RNTesterText>
81-
</View>
75+
<RNTesterText testID="current-state">{currentAppState}</RNTesterText>
8276
);
8377
}
8478

8579
if (props.detectEvents) {
86-
return (
87-
<View>
88-
<RNTesterText>{JSON.stringify(eventsDetected)}</RNTesterText>
89-
</View>
90-
);
80+
return <RNTesterText>{JSON.stringify(eventsDetected)}</RNTesterText>;
9181
}
9282

9383
return (
94-
<View>
95-
<RNTesterText>{JSON.stringify(previousAppStates)}</RNTesterText>
96-
</View>
84+
<RNTesterText testID="previous-states">
85+
{previousAppStates.join(', ')}
86+
</RNTesterText>
9787
);
9888
}
9989

@@ -106,7 +96,11 @@ exports.examples = [
10696
title: 'AppState.currentState',
10797
description: 'Can be null on app initialization',
10898
render(): React.Node {
109-
return <RNTesterText>{AppState.currentState}</RNTesterText>;
99+
return (
100+
<RNTesterText testID="initial-state">
101+
{AppState.currentState}
102+
</RNTesterText>
103+
);
110104
},
111105
},
112106
{

0 commit comments

Comments
 (0)