Skip to content

Commit 74126a4

Browse files
author
Matt Bernier
authored
Merge pull request #60 from mptap/add-test-files-exist
Added unittest to check for specific repo files
2 parents bcb96d3 + d206e6d commit 74126a4

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed

test/main.js

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ var assert = require('assert');
22
var should = require('should');
33
var smtpapi = require('../lib/main');
44
var t = require('./smtpapi_test_strings.json');
5+
var fs = require('fs');
56

67
describe('smtapi', function() {
78
beforeEach(function() {
@@ -144,3 +145,81 @@ describe('smtapi', function() {
144145
header.jsonString().should.eql(t.set_ip_pool);
145146
});
146147
});
148+
149+
describe('smtapi-nodejs repo', function() {
150+
it('should have ./Docker or docker/Docker file', function() {
151+
assert(fileExists('Docker') || fileExists('docker/Docker'));
152+
});
153+
154+
it('should have ./docker-compose.yml or ./docker/docker-compose.yml file', function() {
155+
assert(fileExists('docker-compose.yml') || fileExists('docker/docker-compose.yml'));
156+
});
157+
158+
it('should have ./.env_sample file', function() {
159+
assert(fileExists('.env_sample'));
160+
});
161+
162+
it('should have ./.gitignore file', function() {
163+
assert(fileExists('.gitignore'));
164+
});
165+
166+
it('should have ./.travis.yml file', function() {
167+
assert(fileExists('.travis.yml'));
168+
});
169+
170+
it('should have ./.codeclimate.yml file', function() {
171+
assert(fileExists('.codeclimate.yml'));
172+
});
173+
174+
it('should have ./CHANGELOG.md file', function() {
175+
assert(fileExists('CHANGELOG.md'));
176+
});
177+
178+
it('should have ./CODE_OF_CONDUCT.md file', function() {
179+
assert(fileExists('CODE_OF_CONDUCT.md'));
180+
});
181+
182+
it('should have ./CONTRIBUTING.md file', function() {
183+
assert(fileExists('CONTRIBUTING.md'));
184+
});
185+
186+
it('should have ./.github/ISSUE_TEMPLATE file', function() {
187+
assert(fileExists('.github/ISSUE_TEMPLATE'));
188+
});
189+
190+
it('should have ./LICENSE.md file', function() {
191+
assert(fileExists('LICENSE.md'));
192+
});
193+
194+
it('should have ./.github/PULL_REQUEST_TEMPLATE file', function() {
195+
assert(fileExists('.github/PULL_REQUEST_TEMPLATE'));
196+
});
197+
198+
it('should have ./README.md file', function() {
199+
assert(fileExists('README.md'));
200+
});
201+
202+
it('should have ./TROUBLESHOOTING.md file', function() {
203+
assert(fileExists('TROUBLESHOOTING.md'));
204+
});
205+
206+
it('should have ./USAGE.md file', function() {
207+
assert(fileExists('USAGE.md'));
208+
});
209+
210+
it('should have ./USE_CASES.md file', function() {
211+
assert(fileExists('USE_CASES.md'));
212+
});
213+
214+
function fileExists(filepath) {
215+
try {
216+
return fs.statSync(filepath).isFile();
217+
} catch(e) {
218+
if (e.code === 'ENOENT') {
219+
console.log('' + filepath + ' doesn\'t exist.');
220+
return false;
221+
}
222+
throw e;
223+
}
224+
}
225+
});

0 commit comments

Comments
 (0)