Skip to content

Commit

Permalink
try to add travis and coverals
Browse files Browse the repository at this point in the history
  • Loading branch information
asmyshlyaev177 committed Jul 23, 2018
1 parent 93c5ccc commit 65787b9
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .coveralls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
service_name: travis-ci
repo_token: tMwxnbannXSXlH4pDZ0UuvqZL2Yg0D3Fm
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
sudo: false
language: node_js
node_js:
- "6"
cache:
directories:
- node_modules

script: echo "Running tests against $(node -v)..."
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

![example](/sample.gif)

[![Build Status](https://travis-ci.org/asmyshlyaev177/react-horizontal-scrolling-menu.svg?branch=master)](https://travis-ci.org/asmyshlyaev177/react-horizontal-scrolling-menu)
[![Coverage Status](https://coveralls.io/repos/github/asmyshlyaev177/react-horizontal-scrolling-menu/badge.svg?branch=master)](https://coveralls.io/github/asmyshlyaev177/react-horizontal-scrolling-menu?branch=master)

[Demo](https://asmyshlyaev177.github.io/react-horizontal-scrolling-menu)

This is horizontal scrolling menu component for React.
Expand Down
15 changes: 12 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
"scripts": {
"start": "webpack --env.development --mode development --watch",
"build": "webpack --env.production --mode production",
"test": "jest",
"test:watch": "jest --watch"
"test": "jest --coverage --runInBand --cache=false --ci --coverageReporters=lcov | coveralls",
"test:local": "jest --coverage --runInBand --cache=false --ci --coverageReporters=text",
"test:watch": "jest --watch",
"coveralls": "jscoverage lib && YOURPACKAGE_COVERAGE=1 nodeunit --reporter=lcov"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -48,12 +50,15 @@
"babel-preset-react": "^6.24.1",
"babel-preset-stage-2": "^6.24.1",
"babel-preset-stage-3": "^6.24.1",
"coveralls": "^3.0.2",
"enzyme": "^3.3.0",
"enzyme-adapter-react-16": "^1.1.1",
"eslint": "^5.1.0",
"eslint-plugin-react": "^7.10.0",
"jest": "^23.4.0",
"jscoverage": "^0.6.0",
"jsdom": "^11.11.0",
"nodeunit": "^0.11.3",
"prop-types": "^15.6.2",
"react": "^16.4.1",
"react-dom": "^16.4.1",
Expand All @@ -68,10 +73,14 @@
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
"\\.(css|less)$": "<rootDir>/__mocks__/styleMock.js"
},
"collectCoverage": true,
"collectCoverageFrom": [
"src/scrollMenu.js"
],
"coveragePathIgnorePatterns": [
"/build",
"/node_modules/",
"/examples/",
"/build/",
"jest.js"
]
}
Expand Down
11 changes: 11 additions & 0 deletions src/scrollMenu.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable no-undef */
/* eslint-disable react/react-in-jsx-scope */
/* eslint-disable no-unused-vars */

import ScrollMenu, { Arrow, innerStyle, InnerWrapper } from './scrollMenu';

describe('test Arrow', () => {
Expand Down Expand Up @@ -354,6 +355,16 @@ describe('functions', () => {
expect(wrapper.instance().getNextItemInd(false, [ ['item2', false], ['item4', false] ]))
.toEqual(4);
});

it('getNextItem fn', () => {
expect(wrapper.instance().getNextItem(items[0][0])).toEqual(items[1]);
expect(wrapper.instance().getNextItem(items[6][0])).toEqual(items[6]);
});
it('getPrevItem fn', () => {
expect(wrapper.instance().getPrevItem(items[1][0])).toEqual(items[0]);
expect(wrapper.instance().getPrevItem(items[3][0])).toEqual(items[2]);
expect(wrapper.instance().getPrevItem(items[0][0])).toEqual(items[0]);
});
});

describe('offsets', () => {
Expand Down

0 comments on commit 65787b9

Please sign in to comment.