Skip to content

Add a unittest to check the license.md file date range #567

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

Merged
merged 2 commits into from
Oct 28, 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 .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ script:
- yarn test:client
- yarn test:helpers
- yarn test:typescript
- yarn test:license
notifications:
hipchat:
rooms:
Expand Down
18 changes: 18 additions & 0 deletions license.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
'use strict';

/**
* Dependencies
*/
const fs = require("fs");

/**
* Tests
*/
describe('LICENSE', () => {
it('should contain the current year as the end year of the license', () => {
const license = fs.readFileSync(`${process.cwd()}/LICENSE.md`, 'utf8');
const currentYear= (new Date()).getFullYear();
return expect(license.indexOf(`-${currentYear}`)).to.not.equal(-1);
});
});

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@
"lint": "eslint . --fix",
"prism:install": "curl https://github.com/raw/stoplightio/prism/master/install.sh | sh",
"prism": "prism run --mock --list --spec https://github.com/raw/sendgrid/sendgrid-oai/master/oai_stoplight.json",
"test:all": "babel-node ./node_modules/istanbul/lib/cli cover ./node_modules/mocha/bin/_mocha \"packages/**/*.spec.js\"",
"test:all": "babel-node ./node_modules/istanbul/lib/cli cover ./node_modules/mocha/bin/_mocha \"**/*.spec.js\"",
"test:helpers": "babel-node ./node_modules/istanbul/lib/cli cover ./node_modules/mocha/bin/_mocha \"packages/helpers/**/*.spec.js\"",
"test:client": "babel-node ./node_modules/istanbul/lib/cli cover ./node_modules/mocha/bin/_mocha \"packages/client/**/*.spec.js\"",
"test:mail": "babel-node ./node_modules/istanbul/lib/cli cover ./node_modules/mocha/bin/_mocha \"packages/mail/**/*.spec.js\"",
"test:contact": "babel-node ./node_modules/istanbul/lib/cli cover ./node_modules/mocha/bin/_mocha \"packages/contact-importer/**/*.spec.js\"",
"test:license": "babel-node ./node_modules/istanbul/lib/cli cover ./node_modules/mocha/bin/_mocha license.spec.js",
"test:typescript": "tsc",
"test": "npm run test:all -s",
"coverage": "open -a \"Google Chrome\" ./coverage/lcov-report/index.html"
Expand Down