Skip to content

test: Added unittest to check for specific repo files #60

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 1 commit into from
Oct 28, 2017
Merged
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
79 changes: 79 additions & 0 deletions test/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ var assert = require('assert');
var should = require('should');
var smtpapi = require('../lib/main');
var t = require('./smtpapi_test_strings.json');
var fs = require('fs');

describe('smtapi', function() {
beforeEach(function() {
Expand Down Expand Up @@ -144,3 +145,81 @@ describe('smtapi', function() {
header.jsonString().should.eql(t.set_ip_pool);
});
});

describe('smtapi-nodejs repo', function() {
it('should have ./Docker or docker/Docker file', function() {
assert(fileExists('Docker') || fileExists('docker/Docker'));
});

it('should have ./docker-compose.yml or ./docker/docker-compose.yml file', function() {
assert(fileExists('docker-compose.yml') || fileExists('docker/docker-compose.yml'));
});

it('should have ./.env_sample file', function() {
assert(fileExists('.env_sample'));
});

it('should have ./.gitignore file', function() {
assert(fileExists('.gitignore'));
});

it('should have ./.travis.yml file', function() {
assert(fileExists('.travis.yml'));
});

it('should have ./.codeclimate.yml file', function() {
assert(fileExists('.codeclimate.yml'));
});

it('should have ./CHANGELOG.md file', function() {
assert(fileExists('CHANGELOG.md'));
});

it('should have ./CODE_OF_CONDUCT.md file', function() {
assert(fileExists('CODE_OF_CONDUCT.md'));
});

it('should have ./CONTRIBUTING.md file', function() {
assert(fileExists('CONTRIBUTING.md'));
});

it('should have ./.github/ISSUE_TEMPLATE file', function() {
assert(fileExists('.github/ISSUE_TEMPLATE'));
});

it('should have ./LICENSE.md file', function() {
assert(fileExists('LICENSE.md'));
});

it('should have ./.github/PULL_REQUEST_TEMPLATE file', function() {
assert(fileExists('.github/PULL_REQUEST_TEMPLATE'));
});

it('should have ./README.md file', function() {
assert(fileExists('README.md'));
});

it('should have ./TROUBLESHOOTING.md file', function() {
assert(fileExists('TROUBLESHOOTING.md'));
});

it('should have ./USAGE.md file', function() {
assert(fileExists('USAGE.md'));
});

it('should have ./USE_CASES.md file', function() {
assert(fileExists('USE_CASES.md'));
});

function fileExists(filepath) {
try {
return fs.statSync(filepath).isFile();
} catch(e) {
if (e.code === 'ENOENT') {
console.log('' + filepath + ' doesn\'t exist.');
return false;
}
throw e;
}
}
});