diff --git a/__tests__/__snapshots__/topicCreate.test.native.js.snap.android b/__tests__/__snapshots__/topicCreate.test.native.js.snap.android
index 77744a5..61b2838 100644
--- a/__tests__/__snapshots__/topicCreate.test.native.js.snap.android
+++ b/__tests__/__snapshots__/topicCreate.test.native.js.snap.android
@@ -27,15 +27,35 @@ exports[` renders everything 1`] = `
}
}
>
-
-
+ >
+
+
+
renders everything 1`] = `
}
}
>
-
-
+ >
+
+
+
renders everything 1`] = `
+exports[` renders everything 1`] = `
renders everything 1`] = `
}
>
-
-
renders everything 1`] = `
}
/>
+
renders everything 1`] = `
}
}
>
- NaN
- minutos atrás
+ 1116717
+ dias atrás
@@ -160,7 +171,6 @@ exports[` renders everything 1`] = `
/>
-
renders everything 1`] = `
-
-
-
renders everything 1`] = `
+exports[` renders everything 1`] = `
renders everything 1`] = `
}
>
-
-
renders everything 1`] = `
}
/>
+
renders everything 1`] = `
}
}
>
- NaN
- minutos atrás
+ 1116717
+ dias atrás
@@ -160,7 +171,6 @@ exports[` renders everything 1`] = `
/>
-
renders everything 1`] = `
-
-
-
', () => {
.create()
.toJSON();
expect(tree).toMatchSnapshot();
- expect(wrapper.find('View').length).toBe(16);
+ expect(wrapper.find('View').length).toBe(18);
expect(wrapper.find('Text').length).toBe(10);
- expect(wrapper.find('TouchableOpacity').length).toBe(1);
+ expect(wrapper.find('TouchableOpacity').length).toBe(2);
expect(wrapper.find('Icon').length).toBe(2);
expect(wrapper.find('TextInput').length).toBe(2);
});
@@ -33,12 +33,12 @@ describe('', () => {
styles.TopicCreatemasterView
);
expect(wrapper.find('View').at(2)).toHaveStyle(styles.TopicCreateheader);
- expect(wrapper.find('View').at(6)).toHaveStyle(styles.TopicCreatecontainer);
- expect(wrapper.find('View').at(8)).toHaveStyle(styles.TopicCreateUserDiv);
- expect(wrapper.find('View').at(10)).toHaveStyle(
+ expect(wrapper.find('View').at(8)).toHaveStyle(styles.TopicCreatecontainer);
+ expect(wrapper.find('View').at(10)).toHaveStyle(styles.TopicCreateUserDiv);
+ expect(wrapper.find('View').at(12)).toHaveStyle(
styles.TopicCreatetituloDiv
);
- expect(wrapper.find('View').at(14)).toHaveStyle(
+ expect(wrapper.find('View').at(16)).toHaveStyle(
styles.TopicCreatescrollDiv
);
});
@@ -55,9 +55,6 @@ describe('', () => {
expect(wrapper.find('Text').at(8)).toHaveText('username');
});
it('renders TouchableOpacity correctly', () => {
- expect(wrapper.find('TouchableOpacity').at(0)).toHaveStyle(
- styles.TopicCreatepublicarDiv
- );
expect(wrapper.find('TouchableOpacity').at(0)).toHaveProp('onPress');
});
it('renders Icon correctly', () => {
diff --git a/__tests__/topicView.test.native.js b/__tests__/topicView.test.native.js
index 376dbe1..3dc348f 100644
--- a/__tests__/topicView.test.native.js
+++ b/__tests__/topicView.test.native.js
@@ -12,7 +12,7 @@ jest.mock('@react-native-async-storage/async-storage', () => mockAsyncStorage);
let wrapper;
-describe('', () => {
+describe('', () => {
beforeEach(() => {
wrapper = mount();
});
@@ -23,15 +23,15 @@ describe('', () => {
.toJSON();
expect(tree).toMatchSnapshot();
expect(wrapper.find('KeyboardAvoidingView').length).toBe(1);
- expect(wrapper.find('View').length).toBe(38);
+ expect(wrapper.find('View').length).toBe(36);
expect(wrapper.find('Header').length).toBe(1);
expect(wrapper.find('Image').length).toBe(2);
expect(wrapper.find('Data').length).toBe(1);
expect(wrapper.find('ScrollView').length).toBe(2);
expect(wrapper.find('Comments').length).toBe(1);
- expect(wrapper.find('Text').length).toBe(30);
- expect(wrapper.find('TouchableOpacity').length).toBe(1);
- expect(wrapper.find('Icon').length).toBe(7);
+ expect(wrapper.find('Text').length).toBe(26);
+ expect(wrapper.find('TouchableOpacity').length).toBe(2);
+ expect(wrapper.find('Icon').length).toBe(5);
});
it('renders KeyboardAvoidingView correctly', () => {
expect(wrapper.find('KeyboardAvoidingView').at(0)).toHaveStyle(
@@ -48,7 +48,7 @@ describe('', () => {
expect(wrapper.find('Image').at(0)).toHaveProp('defaultSource');
});
it('renders Data correctly', () => {
- expect(wrapper.find('Data').at(0)).toHaveProp('tempo');
+ expect(wrapper.find('Data').at(0)).toHaveProp('time');
});
it('renders ScrollView correctly', () => {
expect(wrapper.find('ScrollView').at(0)).toHaveStyle(
@@ -70,44 +70,32 @@ describe('', () => {
expect(wrapper.find('View').at(16)).toHaveStyle({ marginTop: 10 });
expect(wrapper.find('View').at(17)).toHaveStyle({ marginTop: 10 });
expect(wrapper.find('View').at(20)).toHaveStyle(styles.topicContainer);
- expect(wrapper.find('View').at(26)).toHaveStyle(styles.shareIcon);
- expect(wrapper.find('View').at(30)).toHaveStyle(styles.commentsBar);
- expect(wrapper.find('View').at(32)).toHaveStyle(styles.commentsListDiv);
- expect(wrapper.find('View').at(34)).toHaveStyle(styles.commentsList);
+ expect(wrapper.find('View').at(28)).toHaveStyle(styles.commentsBar);
+ expect(wrapper.find('View').at(30)).toHaveStyle(styles.commentsListDiv);
+ expect(wrapper.find('View').at(32)).toHaveStyle(styles.commentsList);
});
it('renders Text correctly', () => {
expect(wrapper.find('Text').at(4)).toHaveStyle(styles.nameUser);
expect(wrapper.find('Text').at(8)).toHaveStyle(styles.topicDivTitle);
- expect(wrapper.find('Text').at(24)).toHaveText('Compartilhar');
- expect(wrapper.find('Text').at(24)).toHaveStyle({ fontSize: 10 });
- expect(wrapper.find('Text').at(26)).toHaveStyle(styles.commentsBarText);
- expect(wrapper.find('Text').at(26)).toHaveText('Novo Comentário');
+ expect(wrapper.find('Text').at(22)).toHaveStyle(styles.commentsBarText);
+ expect(wrapper.find('Text').at(22)).toHaveText('Novo Comentário');
});
it('renders TouchableOpacity correctly', () => {
- expect(wrapper.find('TouchableOpacity').at(0)).toHaveStyle(
- styles.commentsBarDiv
- );
expect(wrapper.find('TouchableOpacity').at(0)).toHaveProp('onPress');
});
it('renders Icon correctly', () => {
- expect(wrapper.find('Icon').at(2)).toHaveProp('name', 'arrowup');
+ expect(wrapper.find('Icon').at(1)).toHaveProp('size', 18);
+ expect(wrapper.find('Icon').at(1)).toHaveProp('color', gray.shark());
+ expect(wrapper.find('Icon').at(1)).toHaveProp('onPress');
+ expect(wrapper.find('Icon').at(1)).toHaveProp('name', 'arrowup');
expect(wrapper.find('Icon').at(2)).toHaveProp('size', 18);
expect(wrapper.find('Icon').at(2)).toHaveProp('color', gray.shark());
expect(wrapper.find('Icon').at(2)).toHaveProp('onPress');
- expect(wrapper.find('Icon').at(3)).toHaveProp('name', 'arrowdown');
- expect(wrapper.find('Icon').at(3)).toHaveProp('size', 18);
+ expect(wrapper.find('Icon').at(3)).toHaveProp('name', 'corner-up-right');
+ expect(wrapper.find('Icon').at(3)).toHaveProp('size', 15);
expect(wrapper.find('Icon').at(3)).toHaveProp('color', gray.shark());
- expect(wrapper.find('Icon').at(3)).toHaveProp('onPress');
- expect(wrapper.find('Icon').at(4)).toHaveProp('name', 'edit');
- expect(wrapper.find('Icon').at(4)).toHaveProp('size', 18);
+ expect(wrapper.find('Icon').at(4)).toHaveProp('name', 'triangle-right');
+ expect(wrapper.find('Icon').at(4)).toHaveProp('size', 15);
expect(wrapper.find('Icon').at(4)).toHaveProp('color', gray.shark());
- expect(wrapper.find('Icon').at(4)).toHaveProp('onPress');
- expect(wrapper.find('Icon').at(5)).toHaveProp('name', 'corner-up-right');
- expect(wrapper.find('Icon').at(5)).toHaveProp('size', 15);
- expect(wrapper.find('Icon').at(5)).toHaveProp('color', gray.shark());
- expect(wrapper.find('Icon').at(6)).toHaveStyle(styles.commentsBarIcon);
- expect(wrapper.find('Icon').at(6)).toHaveProp('name', 'triangle-right');
- expect(wrapper.find('Icon').at(6)).toHaveProp('size', 15);
- expect(wrapper.find('Icon').at(6)).toHaveProp('color', gray.shark());
});
});
diff --git a/package.json b/package.json
index 91d300e..4f70479 100644
--- a/package.json
+++ b/package.json
@@ -5,7 +5,7 @@
"ios": "react-native run-ios",
"web": "expo start --web",
"start": "react-native start",
- "test": "jest --all --no-watchman",
+ "test": "jest",
"coverage": "rm -rf coverage/ node_modules/.cache/ && NODE_ENV=test npx jest --collect-coverage",
"lint": "eslint .",
"lint-fix": "eslint . --fix",
diff --git a/src/screen/topic/TopicView.js b/src/screen/topic/TopicView.js
index c0987e5..3e69445 100644
--- a/src/screen/topic/TopicView.js
+++ b/src/screen/topic/TopicView.js
@@ -29,12 +29,16 @@ function Data({ time }) {
const now = new Date();
const tmp = Math.trunc((now - time) / 1000 / 60);
if (tmp / 60 > 24) {
- return {tmp / 24} dias atrás;
+ return (
+ {Math.trunc(tmp / 24)} dias atrás
+ );
}
if (tmp / 3600 > 24) {
- return {tmp / 24} horas atrás;
+ return (
+ {Math.trunc(tmp / 60)} horas atrás
+ );
}
- return {tmp} minutos atrás;
+ return {Math.trunc(tmp)} minutos atrás;
}
export default function TopicView({ navigation }) {