Fixed tests for @tryghost/email-suppression-list

These were missing and caused the build to fail
This commit is contained in:
Fabien "egg" O'Carroll 2022-11-18 14:59:06 +07:00
parent cbe1573fd5
commit 9add72ebb1
3 changed files with 33 additions and 0 deletions

View File

@ -8,6 +8,7 @@
"scripts": {
"dev": "echo \"Implement me!\"",
"test": "NODE_ENV=testing c8 --all --check-coverage --reporter text --reporter cobertura mocha './test/**/*.test.js'",
"test:unit": "yarn test",
"lint:code": "eslint *.js lib/ --ext .js --cache",
"lint": "yarn lint:code && yarn lint:test",
"lint:test": "eslint -c test/.eslintrc.js test/ --ext .js --cache"

View File

@ -0,0 +1,6 @@
const assert = require('assert');
describe('exports', function () {
it('exports the lib/email-suppression-list file', function () {
assert(require('../') === require('../lib/email-suppression-list'));
});
});

View File

@ -0,0 +1,26 @@
const assert = require('assert');
const {EmailSuppressionData} = require('../../lib/email-suppression-list');
describe('EmailSuppressionData', function () {
it('Has null info when not suppressed', function () {
const now = new Date();
const data = new EmailSuppressionData(false, {
reason: 'spam',
timestamp: now
});
assert(data.suppressed === false);
assert(data.info === null);
});
it('', function () {
const now = new Date();
const data = new EmailSuppressionData(true, {
reason: 'spam',
timestamp: now
});
assert(data.suppressed === true);
assert(data.info.reason === 'spam');
assert(data.info.timestamp === now);
});
});