Front: Fix unit test w/ React Paper integration

This commit is contained in:
Arthi-chaud
2022-07-11 11:10:00 +02:00
parent 2308ac47f6
commit db056975aa
2 changed files with 11 additions and 5 deletions

View File

@@ -1,11 +1,11 @@
import React from 'react';
import TestRenderer from 'react-test-renderer';
import App from './App';
import { AppContent } from './App';
describe('<App />', () => {
describe('<AppContent />', () => {
it('has 1 child', () => {
const tree = TestRenderer.create(<App />).toJSON();
const tree = TestRenderer.create(<AppContent />).toJSON();
expect(tree.children.length).toBe(10);
});
});

View File

@@ -9,9 +9,8 @@ const ExampleBox = (props: { textColor: ColorValue, backgroundColor: ColorValue
</View>
)
export default function App() {
export function AppContent() {
return (
<PaperProvider>
<View style={styles.container}>
<ExampleBox backgroundColor={ColorTheme.primary} textColor={ColorTheme.onPrimary}/>
<ExampleBox backgroundColor={ColorTheme.primaryVariant} textColor={ColorTheme.onPrimary}/>
@@ -31,6 +30,13 @@ export default function App() {
/>
<StatusBar style="auto" />
</View>
);
}
export default function App() {
return (
<PaperProvider>
<AppContent/>
</PaperProvider>
);
}