kiwiirc-custom/tests/unit/Misc.spec.js
Georg b3dd3db30b
Adding show_password_box
Signed-off-by: Georg <georg@lysergic.dev>
2021-06-25 07:28:29 +02:00

25 lines
993 B
JavaScript

import * as Misc from '@/helpers/Misc';
describe('Misc.js', () => {
it('should find mentions of nickname in text', () => {
let tests = [
['foo', 'foo', true], // on its own
['Foo', 'foo', true], // different case
['foo bar baz', 'foo', true], // start of line
['baz foo bar', 'foo', true], // in middle of line
['bar baz foo', 'foo', true], // end of line
['missing', 'foo', false], // doesnt exist in text
['baz food bar', 'foo', false], // dont trigger on substrings
['hello food foo bar', 'foo', true], // when substring exists previously
['hello, foo?', 'foo', true], // punctuation test
['foo: hello', 'foo', true], // another
['hello (foo)', 'foo', true], // another
];
tests.forEach((c) => {
let doesMention = Misc.mentionsNick(c[0], c[1]);
expect(doesMention).toEqual(c[2]);
});
});
});