Skip to content

Commit

Permalink
windows and unix test, add badges
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmed-dinar committed Oct 21, 2016
1 parent e74e960 commit 1cea917
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
language: node_js
node_js:
- "4"
- "5"
- "6"
os:
- linux
- osx
notifications:
email: false
after_success:
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2016 Ahmed Dinar
Copyright (c) 2016 Ahmed Dinar <madinar.cse@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# codeforces-cli
A simple Cli tool for Codeforces
# Codeforces CLI
A simple and useful Command Line tool for Codeforces coders

[![Travis branch](https://img.shields.io/travis/ahmed-dinar/codeforces-cli/master.svg?label=unix&style=flat-square)](https://travis-ci.org/ahmed-dinar/codeforces-cli) [![AppVeyor branch](https://img.shields.io/appveyor/ci/ahmed-dinar/codeforces-cli/master.svg?label=windows&style=flat-square)](https://ci.appveyor.com/project/ahmed-dinar/codeforces-cli) [![Coveralls branch](https://img.shields.io/coveralls/ahmed-dinar/codeforces-cli/master.svg?style=flat-square)](https://coveralls.io/github/ahmed-dinar/codeforces-cli) [![David](https://img.shields.io/david/ahmed-dinar/codeforces-cli.svg?label=deps&style=flat-square)](https://david-dm.org/ahmed-dinar/codeforces-cli)


### Under development
24 changes: 24 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
environment:
matrix:
- nodejs_version: "4"
- nodejs_version: "5"
- nodejs_version: "6"

install:
- ps: Install-Product node $env:nodejs_version
- npm install

build: off

test_script:
- node --version
- npm --version
- npm test

version: "{build}"

matrix:
fast_finish: true

cache:
- node_modules
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
},
"scripts": {
"test": "./node_modules/.bin/nyc ./node_modules/.bin/mocha --compilers js:babel-register \"tests/**/*.js\"",
"coverage": "./node_modules/.bin/nyc report --reporter=text-lcov | coveralls"
"coverage": "./node_modules/.bin/nyc report --reporter=text-lcov | coveralls",
"cov-html": "./node_modules/.bin/nyc report --reporter=html"
},
"repository": {
"type": "git",
Expand Down
1 change: 1 addition & 0 deletions src/lib/api/userrating.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ function userrating(handle = null, noChart = false) {
* @param {Array} axisX - x axis data (constest ratings)
* @param {Array} axisY - y axis data (constest ratings)
*/
/* istanbul ignore next */
function showLineChart(axisX,axisY) {

let screen = blessed.screen();
Expand Down
42 changes: 40 additions & 2 deletions tests/api/test_userrating.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,13 @@ var mockResponse = {
};
var mockBody = {
status: 'OK',
result: [],
comment: ''
comment: '',
result: [{
contestName: 'Roud test',
rank: 1,
newRating: 2000,
oldRating: 1900
}]
};

describe('Codeforces', function() {
Expand Down Expand Up @@ -122,6 +127,39 @@ describe('Codeforces', function() {
});

describe('[onerror]', function() {
describe('{Request error}', function() {

var logCalled;

beforeEach(function(){
logCalled = false;
sinon.stub(helpers, 'logr', function () { logCalled = true; });
sinon.stub(process.stderr,'write'); //disable spinner
sinon
.stub(request, 'get')
.yields(new Error('Error'), mockResponse,mockBody);
});

afterEach(function(){
helpers.logr.restore();
process.stderr.write.restore();
request.get.restore();
});

it('should call request', function(done){
userrating('Ahmed_Dinar', true);
expect(request.get.called).to.be.true;
done();
});

it('should call console.error when request failed', function(done){
expect(logCalled).to.be.false;
userrating('Ahmed_Dinar', true);
expect(logCalled).to.be.true;
done();
});
});

describe('{HTTP error}', function() {

var logCalled;
Expand Down

0 comments on commit 1cea917

Please sign in to comment.