mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-03-20 10:47:13 +01:00
38 lines
790 B
TypeScript
38 lines
790 B
TypeScript
|
import { prefixMatchParts } from '../suggestions-model.ts';
|
||
|
|
||
|
describe('prefixMatchParts', () => {
|
||
|
it('separates the prefix from the plain tag', () => {
|
||
|
expect(prefixMatchParts('foobar', 'foo')).toMatchInlineSnapshot(`
|
||
|
[
|
||
|
{
|
||
|
"matched": "foo",
|
||
|
},
|
||
|
"bar",
|
||
|
]
|
||
|
`);
|
||
|
});
|
||
|
|
||
|
it('separates the prefix from the namespaced tag', () => {
|
||
|
expect(prefixMatchParts('bruh:bar', 'bru')).toMatchInlineSnapshot(`
|
||
|
[
|
||
|
{
|
||
|
"matched": "bru",
|
||
|
},
|
||
|
"h:bar",
|
||
|
]
|
||
|
`);
|
||
|
});
|
||
|
|
||
|
it('separates the prefix after the namespace', () => {
|
||
|
expect(prefixMatchParts('foo:bazz', 'baz')).toMatchInlineSnapshot(`
|
||
|
[
|
||
|
"foo:",
|
||
|
{
|
||
|
"matched": "baz",
|
||
|
},
|
||
|
"z",
|
||
|
]
|
||
|
`);
|
||
|
});
|
||
|
});
|