minor change to useless fortune test

indiachan-spamvector
Thomas Lynch 2 years ago
parent 3d07f228b3
commit ee9319f629
  1. 2
      helpers/posting/fortune.js
  2. 13
      helpers/posting/fortune.test.js

@ -4,6 +4,8 @@ const fortunes = ['example1', 'example2', 'example3'];
module.exports = {
fortunes,
regex: /##fortune/gmi,
markdown: () => {

@ -1,12 +1,9 @@
const fortune = require('./fortune.js');
describe('fortune markdown', () => {
const cases = [
{ in: '##fortune', out: "<span class='title'>" },
];
for(let i in cases) {
test(`should contain ${cases[i].out} for an input of ${cases[i].in}`, () => {
expect(cases[i].in.replace(fortune.regex, fortune.markdown.bind(null, false))).toContain(cases[i].out)
});
}
test(`should contain a random fortune for an input of ##fortune`, () => {
const output = '##fortune'.replace(fortune.regex, fortune.markdown.bind(null, false));
const hasFortuneText = fortune.fortunes.some(f => output.includes(f));
expect(hasFortuneText).toBe(true);
});
});

Loading…
Cancel
Save