Skip to content

Commit

Permalink
Fix all tests with magic numbers & static completions
Browse files Browse the repository at this point in the history
  • Loading branch information
confused-Techie committed Jan 12, 2025
1 parent f5fda1d commit 76e95b5
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions packages/autocomplete-css/spec/provider-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ ca {
editor.setCursorBufferPosition([0, 2]);
await whenEditorReady(editor);
let completions = getCompletions();
expect(completions.length).toBeGreaterThan(7); // #398
expect(completions.length).toBeGreaterThan(6); // #398
expect(isValueInCompletions('canvas', completions)).toBe(true);
expect(isValueInCompletions('code', completions)).toBe(true);

Expand All @@ -621,7 +621,8 @@ canvas,ca {
editor.setCursorBufferPosition([0, 9]);
await whenEditorReady(editor);
completions = getCompletions();
expect(completions.length).toBeGreaterThan(7); // #398
expect(completions.length).toBeGreaterThan(6); // #398
expect(isValueInCompletions('canvas', completions)).toBe(true);
expect(completions[0].text).toBe('canvas');

editor.setText(`\
Expand All @@ -632,7 +633,8 @@ canvas ca {
editor.setCursorBufferPosition([0, 9]);
await whenEditorReady(editor);
completions = getCompletions();
expect(completions.length).toBeGreaterThan(7); // #398
expect(completions.length).toBeGreaterThan(6); // #398
expect(isValueInCompletions('canvas', completions)).toBe(true);
expect(completions[0].text).toBe('canvas');

editor.setText(`\
Expand All @@ -643,8 +645,8 @@ canvas, ca {
editor.setCursorBufferPosition([0, 10]);
await whenEditorReady(editor);
completions = getCompletions();
expect(completions.length).toBeGreaterThan(7); // #398
expect(completions[0].text).toBe('canvas');
expect(completions.length).toBeGreaterThan(6); // #398
expect(isValueInCompletions('canvas', completions)).toBe(true);
});

it("does not autocompletes when prefix is preceded by class or id char", async () => {
Expand Down Expand Up @@ -679,7 +681,7 @@ div: {
editor.setCursorBufferPosition([0, 4]);
await whenEditorReady(editor);
const completions = getCompletions();
expect(completions.length).toBeGreaterThanOrEqual(82); // #1191
expect(completions.length).toBeGreaterThan(81); // #1191
for (var completion of Array.from(completions)) {
var text = (completion.text || completion.snippet);
expect(text.length).toBeGreaterThan(0);
Expand Down Expand Up @@ -1115,7 +1117,7 @@ ca\
editor.setCursorBufferPosition([0, 2]);
await whenEditorReady(editor);
let completions = getCompletions();
expect(completions.length).toBeGreaterThanOrEqual(7); // #398
expect(completions.length).toBeGreaterThan(6); // #398
expect(isValueInCompletions('canvas', completions)).toBe(true);
expect(isValueInCompletions('code', completions)).toBe(true);

Expand All @@ -1129,7 +1131,7 @@ canvas,ca\
editor.setCursorBufferPosition([0, 9]);
await whenEditorReady(editor);
completions = getCompletions();
expect(completions.length).toBeGreaterThanOrEqual(7); // #398
expect(completions.length).toBeGreaterThan(6); // #398
expect(isValueInCompletions('canvas', completions)).toBe(true);

editor.setText(`\
Expand All @@ -1139,7 +1141,7 @@ canvas ca\
editor.setCursorBufferPosition([0, 9]);
await whenEditorReady(editor);
completions = getCompletions();
expect(completions.length).toBeGreaterThanOrEqual(7); // #398
expect(completions.length).toBeGreaterThan(6); // #398
expect(isValueInCompletions('canvas', completions)).toBe(true);

editor.setText(`\
Expand All @@ -1149,7 +1151,7 @@ canvas, ca\
editor.setCursorBufferPosition([0, 10]);
await whenEditorReady(editor);
completions = getCompletions();
expect(completions.length).toBeGreaterThanOrEqual(7); // #398
expect(completions.length).toBeGreaterThan(6); // #398
expect(isValueInCompletions('canvas', completions)).toBe(true);
});

Expand Down Expand Up @@ -1183,7 +1185,7 @@ div:\
editor.setCursorBufferPosition([0, 4]);
await whenEditorReady(editor);
const completions = getCompletions();
expect(completions.length).toBeGreaterThanOrEqual(82); // #1191
expect(completions.length).toBeGreaterThan(81); // #1191
for (var completion of Array.from(completions)) {
var text = (completion.text || completion.snippet);
expect(text.length).toBeGreaterThan(0);
Expand Down

0 comments on commit 76e95b5

Please sign in to comment.