Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code Coverage #26

Merged
merged 13 commits into from
Aug 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
__tests__
node_modules
coverage
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ matrix:
- nvm install 8
- node --version
install:
- npm install -g codecov
- npm install
android:
components:
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
[![Build Status](https://img.shields.io/travis/RocketChat/Rocket.Chat.ReactNative/master.svg)](https://travis-ci.org/RocketChat/Rocket.Chat.ReactNative)
[![Project Dependencies](https://david-dm.org/RocketChat/Rocket.Chat.ReactNative.svg)](https://david-dm.org/RocketChat/Rocket.Chat.ReactNative)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/bb15e2392a71473ea59d3f634f35c54e)](https://www.codacy.com/app/RocketChat/Rocket.Chat.ReactNative?utm_source=github.com&utm_medium=referral&utm_content=RocketChat/Rocket.Chat.ReactNative&utm_campaign=badger)
[![codecov](https://codecov.io/gh/RocketChat/Rocket.Chat.ReactNative/branch/master/graph/badge.svg)](https://codecov.io/gh/RocketChat/Rocket.Chat.ReactNative)


**Supported Server Versions:** 0.58.0+ (We are working to support earlier versions)

Expand Down
22 changes: 22 additions & 0 deletions __tests__/RoomItem.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import 'react-native';
import React from 'react';
import RoomItem from '../app/components/RoomItem';

// Note: test renderer must be required after react-native.
import renderer from 'react-test-renderer';

jest.mock('react-native-img-cache', () => {
return {
CachedImage: 'View'
}
});

it('renders correctly', () => {
const tree = renderer.create(
<RoomItem
type="d"
name="name"
/>
).toJSON();
expect(tree).toMatchSnapshot();
});
81 changes: 81 additions & 0 deletions __tests__/__snapshots__/RoomItem.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`renders correctly 1`] = `
<View
style={
Object {
"alignItems": "center",
"flexDirection": "row",
"height": 56,
"paddingLeft": 16,
"paddingRight": 16,
}
}
>
<View
style={
Array [
Object {
"alignItems": "center",
"borderRadius": 20,
"height": 40,
"justifyContent": "center",
"overflow": "hidden",
"width": 40,
},
Object {
"backgroundColor": "#3F51B5",
},
]
}
>
<Text
accessible={true}
allowFontScaling={true}
disabled={false}
ellipsizeMode="tail"
style={
Object {
"color": "#ffffff",
"fontSize": 20,
}
}
>
NA
</Text>
<View
source={
Object {
"uri": "undefined/avatar/name",
}
}
style={
Object {
"borderRadius": 20,
"height": 40,
"position": "absolute",
"width": 40,
}
}
/>
</View>
<Text
accessible={true}
allowFontScaling={true}
disabled={false}
ellipsizeMode="tail"
numberOfLines={1}
style={
Object {
"color": "#444",
"flex": 1,
"fontSize": 16,
"marginLeft": 16,
"marginRight": 4,
}
}
>
name
</Text>
</View>
`;
12 changes: 0 additions & 12 deletions __tests__/index.android.js

This file was deleted.

12 changes: 0 additions & 12 deletions __tests__/index.ios.js

This file was deleted.

51 changes: 51 additions & 0 deletions coverage/clover.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<coverage generated="1503070854493" clover="3.2.0">
<project timestamp="1503070854494" name="All files">
<metrics statements="26" coveredstatements="20" conditionals="13" coveredconditionals="5" methods="4" coveredmethods="4" elements="43" coveredelements="29" complexity="0" loc="26" ncloc="26" packages="3" files="3" classes="3">
<package name="components">
<metrics statements="17" coveredstatements="11" conditionals="10" coveredconditionals="4" methods="3" coveredmethods="3"/>
<file name="RoomItem.js" path="/Users/rodrigonascimento/Projects/Rocket.Chat.ReactNative/app/components/RoomItem.js">
<metrics statements="17" coveredstatements="11" conditionals="10" coveredconditionals="4" methods="3" coveredmethods="3"/>
<line num="9" count="1" type="stmt"/>
<line num="69" count="1" type="stmt"/>
<line num="71" count="1" type="stmt"/>
<line num="78" count="1" type="cond" truecount="1" falsecount="1"/>
<line num="79" count="0" type="stmt"/>
<line num="82" count="1" type="cond" truecount="1" falsecount="1"/>
<line num="83" count="1" type="stmt"/>
<line num="84" count="1" type="stmt"/>
<line num="92" count="0" type="stmt"/>
<line num="94" count="0" type="stmt"/>
<line num="102" count="1" type="cond" truecount="2" falsecount="2"/>
<line num="103" count="1" type="stmt"/>
<line num="106" count="0" type="cond" truecount="0" falsecount="2"/>
<line num="107" count="0" type="stmt"/>
<line num="110" count="0" type="stmt"/>
<line num="118" count="1" type="stmt"/>
<line num="120" count="1" type="stmt"/>
</file>
</package>
<package name="constants">
<metrics statements="2" coveredstatements="2" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0"/>
<file name="colors.js" path="/Users/rodrigonascimento/Projects/Rocket.Chat.ReactNative/app/constants/colors.js">
<metrics statements="2" coveredstatements="2" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0"/>
<line num="1" count="1" type="stmt"/>
<line num="2" count="1" type="stmt"/>
</file>
</package>
<package name="utils">
<metrics statements="7" coveredstatements="7" conditionals="3" coveredconditionals="1" methods="1" coveredmethods="1"/>
<file name="avatarInitialsAndColor.js" path="/Users/rodrigonascimento/Projects/Rocket.Chat.ReactNative/app/utils/avatarInitialsAndColor.js">
<metrics statements="7" coveredstatements="7" conditionals="3" coveredconditionals="1" methods="1" coveredmethods="1"/>
<line num="4" count="1" type="stmt"/>
<line num="6" count="1" type="stmt"/>
<line num="7" count="1" type="stmt"/>
<line num="9" count="1" type="stmt"/>
<line num="11" count="1" type="cond" truecount="1" falsecount="1"/>
<line num="12" count="1" type="stmt"/>
<line num="14" count="1" type="stmt"/>
</file>
</package>
</metrics>
</project>
</coverage>
4 changes: 4 additions & 0 deletions coverage/coverage-final.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{"/Users/rodrigonascimento/Projects/Rocket.Chat.ReactNative/app/components/RoomItem.js": {"path":"/Users/rodrigonascimento/Projects/Rocket.Chat.ReactNative/app/components/RoomItem.js","statementMap":{"0":{"start":{"line":9,"column":15},"end":{"line":58,"column":2}},"1":{"start":{"line":69,"column":34},"end":{"line":69,"column":44}},"2":{"start":{"line":71,"column":15},"end":{"line":76,"column":9}},"3":{"start":{"line":78,"column":2},"end":{"line":80,"column":3}},"4":{"start":{"line":79,"column":3},"end":{"line":79,"column":15}},"5":{"start":{"line":82,"column":2},"end":{"line":90,"column":3}},"6":{"start":{"line":83,"column":31},"end":{"line":83,"column":59}},"7":{"start":{"line":84,"column":3},"end":{"line":89,"column":5}},"8":{"start":{"line":92,"column":20},"end":{"line":92,"column":48}},"9":{"start":{"line":94,"column":2},"end":{"line":98,"column":4}},"10":{"start":{"line":102,"column":2},"end":{"line":104,"column":3}},"11":{"start":{"line":103,"column":3},"end":{"line":103,"column":10}},"12":{"start":{"line":106,"column":2},"end":{"line":108,"column":3}},"13":{"start":{"line":107,"column":3},"end":{"line":107,"column":19}},"14":{"start":{"line":110,"column":2},"end":{"line":114,"column":4}},"15":{"start":{"line":118,"column":27},"end":{"line":118,"column":37}},"16":{"start":{"line":120,"column":2},"end":{"line":126,"column":4}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":68,"column":1},"end":{"line":68,"column":2}},"loc":{"start":{"line":68,"column":12},"end":{"line":99,"column":2}},"line":68},"1":{"name":"(anonymous_1)","decl":{"start":{"line":101,"column":16},"end":{"line":101,"column":17}},"loc":{"start":{"line":101,"column":28},"end":{"line":115,"column":2}},"line":101},"2":{"name":"(anonymous_2)","decl":{"start":{"line":117,"column":1},"end":{"line":117,"column":2}},"loc":{"start":{"line":117,"column":10},"end":{"line":127,"column":2}},"line":117}},"branchMap":{"0":{"loc":{"start":{"line":78,"column":2},"end":{"line":80,"column":3}},"type":"if","locations":[{"start":{"line":78,"column":2},"end":{"line":80,"column":3}},{"start":{"line":78,"column":2},"end":{"line":80,"column":3}}],"line":78},"1":{"loc":{"start":{"line":82,"column":2},"end":{"line":90,"column":3}},"type":"if","locations":[{"start":{"line":82,"column":2},"end":{"line":90,"column":3}},{"start":{"line":82,"column":2},"end":{"line":90,"column":3}}],"line":82},"2":{"loc":{"start":{"line":102,"column":2},"end":{"line":104,"column":3}},"type":"if","locations":[{"start":{"line":102,"column":2},"end":{"line":104,"column":3}},{"start":{"line":102,"column":2},"end":{"line":104,"column":3}}],"line":102},"3":{"loc":{"start":{"line":102,"column":6},"end":{"line":102,"column":28}},"type":"binary-expr","locations":[{"start":{"line":102,"column":6},"end":{"line":102,"column":13}},{"start":{"line":102,"column":17},"end":{"line":102,"column":28}}],"line":102},"4":{"loc":{"start":{"line":106,"column":2},"end":{"line":108,"column":3}},"type":"if","locations":[{"start":{"line":106,"column":2},"end":{"line":108,"column":3}},{"start":{"line":106,"column":2},"end":{"line":108,"column":3}}],"line":106}},"s":{"0":1,"1":1,"2":1,"3":1,"4":0,"5":1,"6":1,"7":1,"8":0,"9":0,"10":1,"11":1,"12":0,"13":0,"14":0,"15":1,"16":1},"f":{"0":1,"1":1,"2":1},"b":{"0":[0,1],"1":[1,0],"2":[1,0],"3":[1,0],"4":[0,0]},"_coverageSchema":"332fd63041d2c1bcb487cc26dd0d5f7d97098a6c","hash":"d139f6f5a86c5ec1234d16fff580f00149385d7e"}
,"/Users/rodrigonascimento/Projects/Rocket.Chat.ReactNative/app/constants/colors.js": {"path":"/Users/rodrigonascimento/Projects/Rocket.Chat.ReactNative/app/constants/colors.js","statementMap":{"0":{"start":{"line":1,"column":29},"end":{"line":1,"column":227}},"1":{"start":{"line":2,"column":26},"end":{"line":2,"column":30}}},"fnMap":{},"branchMap":{},"s":{"0":1,"1":1},"f":{},"b":{},"_coverageSchema":"332fd63041d2c1bcb487cc26dd0d5f7d97098a6c","hash":"6284dad0efd0acc061f96680c6e59b465a058731"}
,"/Users/rodrigonascimento/Projects/Rocket.Chat.ReactNative/app/utils/avatarInitialsAndColor.js": {"path":"/Users/rodrigonascimento/Projects/Rocket.Chat.ReactNative/app/utils/avatarInitialsAndColor.js","statementMap":{"0":{"start":{"line":4,"column":18},"end":{"line":4,"column":56}},"1":{"start":{"line":6,"column":15},"end":{"line":6,"column":38}},"2":{"start":{"line":7,"column":1},"end":{"line":7,"column":100}},"3":{"start":{"line":9,"column":23},"end":{"line":9,"column":42}},"4":{"start":{"line":11,"column":16},"end":{"line":11,"column":160}},"5":{"start":{"line":12,"column":1},"end":{"line":12,"column":35}},"6":{"start":{"line":14,"column":1},"end":{"line":14,"column":28}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":3,"column":15},"end":{"line":3,"column":16}},"loc":{"start":{"line":3,"column":39},"end":{"line":15,"column":1}},"line":3}},"branchMap":{"0":{"loc":{"start":{"line":3,"column":24},"end":{"line":3,"column":37}},"type":"default-arg","locations":[{"start":{"line":3,"column":35},"end":{"line":3,"column":37}}],"line":3},"1":{"loc":{"start":{"line":11,"column":16},"end":{"line":11,"column":160}},"type":"cond-expr","locations":[{"start":{"line":11,"column":43},"end":{"line":11,"column":107}},{"start":{"line":11,"column":110},"end":{"line":11,"column":160}}],"line":11}},"s":{"0":1,"1":1,"2":1,"3":1,"4":1,"5":1,"6":1},"f":{"0":1},"b":{"0":[0],"1":[0,1]},"_coverageSchema":"332fd63041d2c1bcb487cc26dd0d5f7d97098a6c","hash":"71f82ed0f6c31295c1916090885bad58fe88ebab"}
}
Loading