Skip to content

Commit 344dfad

Browse files
committed
fix: integ tests failing
1 parent fd6bd12 commit 344dfad

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/extensions/default/Phoenix-prettier/unittests.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ define(function (require, exports, module) {
3232

3333
const PLATFORM_LINE_ENDINGS = (FileUtils.getPlatformLineEndings() === 'CRLF' ? "\r\n" : "\n");
3434

35+
function normalizeLineEndings(str) {
36+
return str.replace(/\r\n/g, "\n");
37+
}
38+
3539
require("./main");
3640

3741
const jsFile = require("text!../../../../test/spec/prettier-test-files/js/test.js"),
@@ -154,7 +158,9 @@ define(function (require, exports, module) {
154158
createMockEditor(jsFile, "javascript", "/test.js");
155159
testEditor.setSelection({line: 4, ch: 0}, {line: 6, ch: 0});
156160
await BeautificationManager.beautifyEditor(testEditor);
157-
expect(testEditor.document.getText(true)+ PLATFORM_LINE_ENDINGS).toBe(jsPrettySelectionOffset);
161+
const actual = normalizeLineEndings(testEditor.document.getText(true) + PLATFORM_LINE_ENDINGS);
162+
const expected = normalizeLineEndings(jsPrettySelectionOffset);
163+
expect(actual).toBe(expected);
158164
});
159165

160166
it("should not beautify editor on incomplete syntax selection for js", async function () {
@@ -209,7 +215,9 @@ define(function (require, exports, module) {
209215
createMockEditor(htmlFile, "html", "/test.html");
210216
testEditor.setSelection({line: 4, ch: 0}, {line: 6, ch: 0});
211217
await BeautificationManager.beautifyEditor(testEditor);
212-
expect(testEditor.document.getText(true)+ PLATFORM_LINE_ENDINGS).toBe(htmlPrettySelectionOffset);
218+
const actual = normalizeLineEndings(testEditor.document.getText(true) + PLATFORM_LINE_ENDINGS);
219+
const expected = normalizeLineEndings(htmlPrettySelectionOffset);
220+
expect(actual).toBe(expected);
213221
});
214222

215223
it("should not beautify editor on incomplete syntax selection for html", async function () {

0 commit comments

Comments
 (0)