39 lines
1.0 KiB
TypeScript
39 lines
1.0 KiB
TypeScript
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
import { getTagStatus } from './tagsStatus';
|
|
|
|
describe('The getTagStatus function', () => {
|
|
it('should return undefined/false for a tag that does NOT exist', () => {
|
|
expect(getTagStatus('whatever', {}, '', '')).toEqual({
|
|
highlighted: false,
|
|
});
|
|
});
|
|
it('should return definition/true for a tag that exists and is highlighted', () => {
|
|
expect(
|
|
getTagStatus(
|
|
'whatever',
|
|
{ hiking: { route: { eating: { whatever: {} } } } },
|
|
'hiking',
|
|
'eating'
|
|
)
|
|
).toEqual({
|
|
type: 'route',
|
|
definition: {},
|
|
highlighted: true,
|
|
});
|
|
});
|
|
it('should return definition/false for a tag that exists and is NOT highlighted', () => {
|
|
expect(
|
|
getTagStatus(
|
|
'whatever',
|
|
{ hiking: { route: { eating: { whatever: {} } } } },
|
|
'hiking',
|
|
'sleeping'
|
|
)
|
|
).toEqual({
|
|
type: 'route',
|
|
definition: {},
|
|
highlighted: false,
|
|
});
|
|
});
|
|
});
|