-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from Moises088/develop
Develop
- Loading branch information
Showing
53 changed files
with
1,329 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { AsyncMock } from "../../src/constants/storage.constant"; | ||
import { DebtsDto } from "../../src/interfaces/services/debts.interface"; | ||
import { AppDebtsService } from "../../src/services/debts"; | ||
|
||
const debt: DebtsDto = { total: 100, totalPerMonth: 10, paidMonthAt: "11-10", type: "INVOICE", institutionId: 1 } | ||
const sameDebt = AsyncMock['ASYNC_DEBTS'][0]; | ||
|
||
describe("services/debt", () => { | ||
describe("method find", () => { | ||
it("find debts and result must be DebtsDto array", async () => { | ||
const debts = await AppDebtsService.find(); | ||
expect(debts).toEqual( | ||
expect.arrayContaining([ | ||
expect.objectContaining({ ...sameDebt, id: 1 }) | ||
]) | ||
) | ||
}) | ||
}); | ||
|
||
describe("method findOne", () => { | ||
it("find where id = 1 result must be DebtsDto", async () => { | ||
const debt = await AppDebtsService.findOne(1); | ||
expect(debt).toEqual({ ...sameDebt, id: 1 }) | ||
}) | ||
|
||
it("find where id = 2 result must be undefined", async () => { | ||
const debt = await AppDebtsService.findOne(2); | ||
expect(debt).toBeUndefined() | ||
}) | ||
}); | ||
|
||
describe("method create", () => { | ||
it("create new debt and result must be { id: 2, ...debt }", async () => { | ||
const newDebt = await AppDebtsService.create(debt); | ||
|
||
expect(newDebt.id).toEqual(2); | ||
expect(newDebt.total).toEqual(100); | ||
expect(newDebt.totalPerMonth).toEqual(10); | ||
expect(newDebt.institutionId).toEqual(1); | ||
expect(newDebt.institutionName).toBeUndefined(); | ||
expect(newDebt.paidMonthAt).toEqual("11-10"); | ||
expect(newDebt.type).toEqual("INVOICE"); | ||
}) | ||
}); | ||
|
||
describe("method delete", () => { | ||
it("id 1", async () => { | ||
const debts = await AppDebtsService.delete(1); | ||
expect(debts.length).toBe(0); | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import React from 'react'; | ||
import { View, Text, TouchableOpacity, Animated, Image } from 'react-native'; | ||
import { ThemeContext } from '../../../contexts/themeContext'; | ||
import { FontAwesome5 } from '@expo/vector-icons'; | ||
import { styles } from './styles'; | ||
import { DebtsInstitution } from '../../../interfaces/services/debts.interface'; | ||
|
||
const DebtsCard: React.FC<{ institution: DebtsInstitution | undefined }> = ({ institution }) => { | ||
|
||
const spinValue = React.useRef(new Animated.Value(0)).current; | ||
const spin = spinValue.interpolate({ | ||
inputRange: [0, 1, 2, 3, 4, 5, 6], | ||
outputRange: ['0deg', '30deg', '60deg', '90deg', '-30deg', '-60deg', '0deg'] | ||
}) | ||
|
||
const { theme } = React.useContext(ThemeContext); | ||
const style = styles(theme); | ||
|
||
const [backgroundColor, setBackgroundColor] = React.useState("#FFF") | ||
const [image, setImage] = React.useState() | ||
|
||
React.useEffect(() => { | ||
animated() | ||
}, [institution]) | ||
|
||
const animated = () => { | ||
setTimeout(() => { | ||
if (institution?.color) { | ||
setBackgroundColor(institution.color) | ||
setImage(institution.logo) | ||
} | ||
}, 450); | ||
|
||
Animated.sequence([ | ||
Animated.timing(spinValue, { | ||
toValue: 3, | ||
duration: 450, | ||
useNativeDriver: true, | ||
}), | ||
Animated.timing(spinValue, { | ||
toValue: 6, | ||
duration: 450, | ||
useNativeDriver: true, | ||
}) | ||
]).start() | ||
} | ||
|
||
return ( | ||
<Animated.View style={[ | ||
style.container, | ||
{ | ||
transform: [{ rotateY: spin }], | ||
backgroundColor | ||
} | ||
]}> | ||
<View style={style.containerLogo}> | ||
{image && ( | ||
<Image source={image} style={style.image} /> | ||
)} | ||
</View> | ||
<View style={style.containerTitle}> | ||
<Text style={[style.title, { color: institution?.color != "#FFF" ? "#FFF" : "#000" }]}> | ||
FATURA | ||
</Text> | ||
</View> | ||
</Animated.View> | ||
) | ||
} | ||
export default DebtsCard; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { StyleSheet } from 'react-native'; | ||
import { WINDOW_WIDTH } from '../../../constants/screen.contants'; | ||
import { ThemesConfig } from '../../../interfaces/screens/themes.interace'; | ||
|
||
export const styles = (theme: ThemesConfig) => { | ||
return StyleSheet.create({ | ||
container: { | ||
width: "100%", | ||
height: 150, | ||
borderRadius: 15, | ||
backgroundColor: 'red', | ||
padding: 10 | ||
}, | ||
containerLogo: { | ||
flex: 1, | ||
justifyContent: "center", | ||
alignItems: "flex-end", | ||
}, | ||
containerTitle: { | ||
flex: 1, | ||
justifyContent: "flex-end" | ||
}, | ||
title: { | ||
fontSize: 15, | ||
fontWeight: "bold", | ||
letterSpacing: 1 | ||
}, | ||
image: { | ||
maxWidth: 90, | ||
maxHeight: 70, | ||
marginTop: 10 | ||
} | ||
}) | ||
}; |
Oops, something went wrong.