Skip to content

Commit

Permalink
test cleanups, dep shedding
Browse files Browse the repository at this point in the history
  • Loading branch information
msimerson committed Apr 4, 2024
1 parent f8e7d1d commit 9b0bc42
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 25 deletions.
1 change: 0 additions & 1 deletion Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,3 @@
- initial release


[1.0.4]: https://github.com/haraka/haraka-dsn/releases/tag/1.0.4
10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
},
"main": "index.js",
"scripts": {
"lint": "npx eslint *.js test",
"lintfix": "npx --fix *.js test",
"test": "npx mocha"
"lint": "npx eslint@^8 *.js test",
"lintfix": "npx exlint@^8 --fix *.js test",
"test": "npx mocha@^10"
},
"repository": {
"type": "git",
Expand All @@ -26,10 +26,8 @@
},
"homepage": "https://github.com/haraka/haraka-dsn#readme",
"devDependencies": {
"eslint": ">=8",
"eslint-plugin-haraka": "*",
"haraka-constants": "*",
"mocha": ">=9"
"haraka-constants": "*"
},
"dependencies": {}
}
27 changes: 9 additions & 18 deletions test/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
'use strict';

const assert = require('assert')

Expand All @@ -7,61 +6,53 @@ const constants = require('haraka-constants');
constants.import(global);

describe('haraka-dsn', function () {
beforeEach(function (done) {
beforeEach(function () {
this.DSN = require('../index')
done()
})


it('should load', function (done) {
it('should load', function () {
assert.ok(this.DSN);
done()
})

it('create, only code', function (done) {
it('create, only code', function () {
assert.deepEqual({
code: 200, msg: undefined, cls: 2, sub: 0, det: 0,
default_msg: 'Other undefined status',
reply: '2.0.0 Other undefined status'
},
this.DSN.create(200)
);
done()
)
})

it('create, code w/msg', function (done) {
it('create, code w/msg', function () {
assert.deepEqual({
code: 200, msg: 'test msg', cls: 2, sub: 0, det: 0,
default_msg: 'Other undefined status',
reply: '2.0.0 test msg'
},
this.DSN.create(200, 'test msg')
);
done()
)
})

it('create, code w/msg & subject', function (done) {
it('create, code w/msg & subject', function () {
assert.deepEqual({
code: 200, msg: 'test msg', cls: 2, sub: 7, det: 0,
default_msg: 'Other or undefined security status',
reply: '2.7.0 test msg'
},
this.DSN.create(200, 'test msg', 7)
);
done()
})

it('net_unspecified returns expected code & message', function (done) {
it('net_unspecified returns expected code & message', function () {
const r = this.DSN.net_unspecified()
assert.equal(r.code, 450)
assert.equal(r.default_msg, 'Other or undefined network or routing status')
done()
})

it('net_unable_to_route returns expected code & message', function (done) {
it('net_unable_to_route returns expected code & message', function () {
const r = this.DSN.net_unable_to_route()
assert.equal(r.code, 550)
assert.equal(r.default_msg, 'Unable to route')
done()
})
})

0 comments on commit 9b0bc42

Please sign in to comment.