Compare commits
No commits in common. 'master' and 'tp7' have entirely different histories.
@ -1,22 +0,0 @@
|
|||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: default
|
|
||||||
steps:
|
|
||||||
- name: build
|
|
||||||
image: hub.codefirst.iut.uca.fr/camille.petitalot/drone-sonarplugin-reactnative:latest
|
|
||||||
commands:
|
|
||||||
- cd JokesApp
|
|
||||||
- npm install
|
|
||||||
|
|
||||||
- name : sonar
|
|
||||||
image : hub.codefirst.iut.uca.fr/camille.petitalot/drone-sonarplugin-reactnative:latest
|
|
||||||
environment:
|
|
||||||
sonar_host: https://codefirst.iut.uca.fr/sonar/
|
|
||||||
sonar_token:
|
|
||||||
from_secret: SECRET_SONAR_LOGIN
|
|
||||||
project_key: JokesAppSonar
|
|
||||||
commands:
|
|
||||||
- cd JokesApp
|
|
||||||
- npm install
|
|
||||||
- npm run test
|
|
||||||
- sonar-scanner -Dsonar.projectKey=$${project_key} -Dsonar.sources=. -Dsonar.host.url=$${sonar_host} -Dsonar.login=$${sonar_token} -Dsonar.javascript.lcov.reportPaths=/lcov.info -Dsonar.exclusions=/coverage//*,/tests/*/
|
|
@ -1,5 +0,0 @@
|
|||||||
# Default ignored files
|
|
||||||
/shelf/
|
|
||||||
/workspace.xml
|
|
||||||
# Editor-based HTTP Client requests
|
|
||||||
/httpRequests/
|
|
@ -1,12 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module type="WEB_MODULE" version="4">
|
|
||||||
<component name="NewModuleRootManager">
|
|
||||||
<content url="file://$MODULE_DIR$">
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
|
||||||
</content>
|
|
||||||
<orderEntry type="inheritedJdk" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectModuleManager">
|
|
||||||
<modules>
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/Tp_ReactNative.iml" filepath="$PROJECT_DIR$/.idea/Tp_ReactNative.iml" />
|
|
||||||
</modules>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="VcsDirectoryMappings">
|
|
||||||
<mapping directory="" vcs="Git" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
File diff suppressed because it is too large
Load Diff
@ -1,103 +0,0 @@
|
|||||||
import {useTheme} from "@react-navigation/native";
|
|
||||||
import {darksalmonColor, indigo, whiteColor} from "../Theme";
|
|
||||||
import React, {useEffect, useState} from "react";
|
|
||||||
import {getFavorite} from "../redux/store";
|
|
||||||
import {FlatList, SafeAreaView, StyleSheet, TouchableHighlight, View, Text} from "react-native";
|
|
||||||
import {JokeListItems} from "../components/ListeJokeComponent";
|
|
||||||
import {CustomJoke} from "../model/CustomJoke";
|
|
||||||
import {SampleJoke} from "../model/SampleJoke";
|
|
||||||
import {useAppSelector, useAppDispatch} from "../redux/store";
|
|
||||||
import {useDispatch} from "react-redux";
|
|
||||||
export function ListFavoriteJokeScreen({route, navigation}){
|
|
||||||
|
|
||||||
const favoriteJokes: CustomJoke[] = useAppSelector((state) => state.customReducer.favoriteJokes);
|
|
||||||
const dispatch = useDispatch();
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const getFavoriteJokes = async () => {
|
|
||||||
// @ts-ignore
|
|
||||||
await dispatch(getFavorite());
|
|
||||||
}
|
|
||||||
getFavoriteJokes();
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const styles = themeSettings();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<SafeAreaView style={styles.container}>
|
|
||||||
{ favoriteJokes.length ? (
|
|
||||||
<FlatList
|
|
||||||
data = {favoriteJokes}
|
|
||||||
renderItem={({ item }) => (
|
|
||||||
<TouchableHighlight onPress={() => navigation.navigate("JokeDetail", {"joke" : item.id})}>
|
|
||||||
<JokeListItems item={item}/>
|
|
||||||
</TouchableHighlight>
|
|
||||||
)}
|
|
||||||
keyExtractor={(item) => item.id.toString()}
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<Text style={styles.title}>Aucun favoris</Text>
|
|
||||||
)}
|
|
||||||
|
|
||||||
</SafeAreaView>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
export function themeSettings() {
|
|
||||||
const {colors} = useTheme();
|
|
||||||
const styles = StyleSheet.create({
|
|
||||||
title: {
|
|
||||||
fontSize: 24,
|
|
||||||
color: colors.text,
|
|
||||||
textAlign: 'center',
|
|
||||||
fontWeight: 'bold',
|
|
||||||
marginVertical: 20,
|
|
||||||
},
|
|
||||||
titleResume: {
|
|
||||||
fontSize: 15,
|
|
||||||
fontWeight: 'bold',
|
|
||||||
marginBottom: 20,
|
|
||||||
},
|
|
||||||
container: {
|
|
||||||
flex: 1,
|
|
||||||
backgroundColor: colors.background,
|
|
||||||
|
|
||||||
},
|
|
||||||
top: {
|
|
||||||
backgroundColor : indigo,
|
|
||||||
},
|
|
||||||
header: {
|
|
||||||
flexDirection: "row",
|
|
||||||
justifyContent: "space-between",
|
|
||||||
alignItems: "center",
|
|
||||||
margin: 9,
|
|
||||||
},
|
|
||||||
headerText: {
|
|
||||||
fontSize: 18,
|
|
||||||
color: whiteColor,
|
|
||||||
textAlign: 'center',
|
|
||||||
fontWeight: 'bold',
|
|
||||||
},
|
|
||||||
img2: {
|
|
||||||
tintColor: whiteColor,
|
|
||||||
justifyContent: "center",
|
|
||||||
alignItems: "center",
|
|
||||||
},
|
|
||||||
button2:{
|
|
||||||
flexDirection: "row",
|
|
||||||
justifyContent: "center",
|
|
||||||
marginRight: 10,
|
|
||||||
borderRadius: 10,
|
|
||||||
alignItems: "center",
|
|
||||||
height: 30,
|
|
||||||
width: 70,
|
|
||||||
|
|
||||||
borderColor: darksalmonColor,
|
|
||||||
borderWidth: 1,
|
|
||||||
backgroundColor: darksalmonColor,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
return styles;
|
|
||||||
}
|
|
@ -1,63 +0,0 @@
|
|||||||
|
|
||||||
import {describe,test ,expect, jest, it} from "@jest/globals";
|
|
||||||
import {CustomJoke} from "../../model/CustomJoke";
|
|
||||||
import {
|
|
||||||
CustomActionType,
|
|
||||||
getJokesCustoms,
|
|
||||||
setCustomsJoke,
|
|
||||||
setCustomsJokeById, setDeleteCustomJoke, setFavoriteJoke,
|
|
||||||
setPostJoke
|
|
||||||
} from "../../redux/actions/customAction";
|
|
||||||
|
|
||||||
|
|
||||||
describe('Action tests', () => {
|
|
||||||
it('setPostJoke creates correct action', () => {
|
|
||||||
const postJoke = new CustomJoke('test', 'Why did the chicken...', 'To get to the other side!', 'http://www.jokes.com/joke1', "1");
|
|
||||||
const expectedAction = {
|
|
||||||
type: CustomActionType.POST_CUSTOM_JOKE,
|
|
||||||
payload: postJoke,
|
|
||||||
};
|
|
||||||
expect(setPostJoke(postJoke)).toEqual(expectedAction);
|
|
||||||
});
|
|
||||||
|
|
||||||
it ('setCustomsJoke creates correct action', () => {
|
|
||||||
const customJokes = [new CustomJoke('test', 'Why did the chicken...', 'To get to the other side!', 'http://www.jokes.com/joke1', "1")];
|
|
||||||
const expectedAction = {
|
|
||||||
type: CustomActionType.FETCH_CUSTOMS_JOKE,
|
|
||||||
payload: customJokes,
|
|
||||||
};
|
|
||||||
expect(setCustomsJoke(customJokes)).toEqual(expectedAction);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
it('setCustomsJokeById creates correct action', () => {
|
|
||||||
const completCustomJoke = new CustomJoke('test', 'Why did the chicken...', 'To get to the other side!', 'http://www.jokes.com/joke1', "1");
|
|
||||||
const expectedAction = {
|
|
||||||
type: CustomActionType.FETCH_CUSTOMS_JOKE_BY_ID,
|
|
||||||
payload: completCustomJoke,
|
|
||||||
};
|
|
||||||
expect(setCustomsJokeById(completCustomJoke)).toEqual(expectedAction);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
it('setDeleteCustomJoke creates correct action', () => {
|
|
||||||
const deleteCustomJoke = new CustomJoke('test', 'Why did the chicken...', 'To get to the other side!', 'http://www.jokes.com/joke1', "1");
|
|
||||||
const expectedAction = {
|
|
||||||
type: CustomActionType.DELETE_CUSTOM_JOKE,
|
|
||||||
payload: deleteCustomJoke,
|
|
||||||
};
|
|
||||||
expect(setDeleteCustomJoke(deleteCustomJoke)).toEqual(expectedAction);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
it('setFavoriteJoke creates correct action', () => {
|
|
||||||
const favoriteJokes = [new CustomJoke('test', 'Why did the chicken...', 'To get to the other side!', 'http://www.jokes.com/joke1', "1")];
|
|
||||||
const expectedAction = {
|
|
||||||
type: CustomActionType.FETCH_FAVORITE_JOKE,
|
|
||||||
payload: favoriteJokes,
|
|
||||||
};
|
|
||||||
expect(setFavoriteJoke(favoriteJokes)).toEqual(expectedAction);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
});
|
|
Loading…
Reference in new issue