Skip to content

Commit

Permalink
test: join lines using EOL from the os
Browse files Browse the repository at this point in the history
  • Loading branch information
wkillerud committed Apr 23, 2024
1 parent 81c1e57 commit d7c7705
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ const getEdit = (result: CodeAction): TextEdit[] => {
};

test("extraction for variable", async () => {
const document = fileSystemProvider.createDocument("--var: black;");
const document = fileSystemProvider.createDocument([
"--var: black;",
".a { color: var(--var); }",
]);

const result = await ls.getCodeActions(
document,
Expand Down
3 changes: 2 additions & 1 deletion packages/language-services/src/utils/test-helpers.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { EOL } from "node:os";
import { join } from "path";
import {
LanguageServiceOptions,
Expand All @@ -19,7 +20,7 @@ class MemoryFileSystem implements FileSystemProvider {
lines: string[] | string,
options: { uri?: string; languageId?: string; version?: number } = {},
): TextDocument {
const text = Array.isArray(lines) ? lines.join("\n") : lines;
const text = Array.isArray(lines) ? lines.join(EOL) : lines;
const uri = URI.file(join(process.cwd(), options.uri || "index.scss"));
const document = TextDocument.create(
uri.toString(),
Expand Down

0 comments on commit d7c7705

Please sign in to comment.