Skip to content
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).

### Unreleased

- test: convert runner from mocha to node --test

### [2.2.3] - 2025-01-13

- dep(eslint): upgrade to v9
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"lint:fix": "npx eslint *.js test --fix",
"prettier": "npx prettier . --check",
"prettier:fix": "npx prettier . --write --log-level=warn",
"test": "npx mocha@10",
"test": "node --test",
"versions": "npx dependency-version-checker check",
"versions:fix": "npx dependency-version-checker update && npm run prettier:fix"
},
Expand All @@ -31,7 +31,7 @@
"url": "https://github.com/haraka/node-address-rfc2822.git"
},
"devDependencies": {
"@haraka/eslint-config": "2.0.2"
"@haraka/eslint-config": "^2.0.2"
},
"license": "MIT",
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions test/Address.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const assert = require('node:assert/strict')
const { describe, it } = require('node:test');

const address = require('../index')

Expand Down
1 change: 1 addition & 0 deletions test/basic.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const assert = require('node:assert/strict')
const { describe, it } = require('node:test');
const fs = require('fs')
const path = require('path')

Expand Down
31 changes: 11 additions & 20 deletions test/functions.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,35 @@
const assert = require('assert')
const { describe, it } = require('node:test');

const address = require('../index')

describe('isAllLower', function () {
it('lower latin string', function (done) {
it('lower latin string', function () {
assert.equal(true, address.isAllLower('abcdefg'))
done()
})
})

describe('isAllUpper', function () {
it('upper latin string', function (done) {
it('upper latin string', function () {
assert.equal(true, address.isAllUpper('ABCDEFG'))
done()
})
})

describe('nameCase', function () {
it('john doe -> John Doe', function (done) {
it('john doe -> John Doe', function () {
assert.equal('John Doe', address.nameCase('john doe'))
done()
})
it('JANE SMITH -> Jane Smith', function (done) {
it('JANE SMITH -> Jane Smith', function () {
assert.equal('Jane Smith', address.nameCase('JANE SMITH'))
done()
})
it('marty mcleod -> Marty McLeod', function (done) {
it('marty mcleod -> Marty McLeod', function () {
assert.equal('Marty McLeod', address.nameCase('marty mcleod'))
done()
})
it("martin o'mally -> Martin O'Malley", function (done) {
it("martin o'mally -> Martin O'Malley", function () {
assert.equal("Martin O'Malley", address.nameCase("martin o'malley"))
done()
})
it('level iii support -> Level III Support', function (done) {
it('level iii support -> Level III Support', function () {
assert.equal('Level III Support', address.nameCase('level iii support'))
done()
})
})

Expand Down Expand Up @@ -82,7 +76,7 @@ describe('parseSender', function () {
})

describe('parseReplyTo', function () {
it('=?utf-8?Q?Anne=20Standley=2C=20Protect=20My=20Public=20Media?= <[email protected]>', function (done) {
it('=?utf-8?Q?Anne=20Standley=2C=20Protect=20My=20Public=20Media?= <[email protected]>', function () {
try {
const r = address.parseReplyTo(
'=?utf-8?Q?Anne=20Standley=2C=20Protect=20My=20Public=20Media?= <[email protected]>',
Expand All @@ -97,21 +91,19 @@ describe('parseReplyTo', function () {
} catch (e) {
console.error(e)
}
done()
})
})

describe('parse with options', function () {
it('should not allow parsing display name with comma by default', function (done) {
it('should not allow parsing display name with comma by default', function () {
try {
address.parse('Foo, Bar <[email protected]>')
} catch (e) {
assert.equal(e.message, 'No results')
}
done()
})

it('should allow parsing display name with comma', function (done) {
it('should allow parsing display name with comma', function () {
try {
const [r] = address.parse('Foo, Bar <[email protected]>', {
allowCommaInDisplayName: true,
Expand All @@ -121,6 +113,5 @@ describe('parse with options', function () {
} catch (e) {
console.error(e)
}
done()
})
})