Skip to content

Commit

Permalink
One more tc
Browse files Browse the repository at this point in the history
  • Loading branch information
zlimez committed Dec 5, 2023
1 parent 81ae091 commit e7e170a
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,13 @@ describe('shouldApplyHighlight', () => {

describe('getHighlightType', () => {
const rules = HighlightRule.parseAllRules(
'3,4[1:5],1[:]-2, 6-8', 0, 'line1\nline2\nline3\nline4\nline5\nline6\nline7\nline8',
'3,4[1:5],1[:]-2,6-8,9[:]', 0, 'line1\nline2\nline3\nline4\nline5\nline6\nline7\nline8\nline9',
);
const wholeTextRule = rules[0];
const partialTextRule = rules[1];
const wholeLinesRule = rules[2];
const wholeTextsRule = rules[3];
const wholeLineRule = rules[4];

test('returns WholeLine for two lines', () => {
expect(wholeLinesRule.getHighlightType(1).highlightType).toBe(HIGHLIGHT_TYPES.WholeLine);
Expand All @@ -81,6 +82,10 @@ describe('getHighlightType', () => {
expect(highlightType).toBe(HIGHLIGHT_TYPES.WholeText);
});

test('returns WholeLine for single line', () => {
expect(wholeLineRule.getHighlightType(9).highlightType).toBe(HIGHLIGHT_TYPES.WholeLine);
});

test('returns PartialText for bounded slice', () => {
const { highlightType, bounds } = partialTextRule.getHighlightType(4);
expect(highlightType).toBe(HIGHLIGHT_TYPES.PartialText);
Expand Down

0 comments on commit e7e170a

Please sign in to comment.