Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

Commit

Permalink
fix the formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
leops committed Oct 6, 2022
1 parent b885f80 commit 32b0768
Showing 1 changed file with 68 additions and 75 deletions.
143 changes: 68 additions & 75 deletions npm/js-api/tests/wasm/diagnosticPrinter.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,86 +2,79 @@ import { describe, expect, it } from "vitest";
import { DiagnosticPrinter } from "@rometools/wasm-nodejs";

describe("Rome WebAssembly DiagnosticPrinter", () => {
it("should format content", async () => {
const SOURCE_CODE =
`const variable = expr();
it("should format content", async () => {
const SOURCE_CODE = `const variable = expr();
if(expr()) {
statement();
}`;
const printer = new DiagnosticPrinter("file.js", SOURCE_CODE);
const printer = new DiagnosticPrinter("file.js", SOURCE_CODE);

printer.print({
"advices": {
"advices": [],
},
"category": "parse",
"description": "error description content",
"location": {
"path": {
"File": {
"PathAndId": {
"file_id": 0,
"path": "file.js",
},
},
},
"source_code": null,
"span": [
31,
37,
],
},
"message": [
{
"content": "error message content",
"elements": [],
},
],
"severity": "Error",
"source": null,
"tags": [],
"verbose_advices": {
"advices": [],
},
});
printer.print({
advices: {
advices: [],
},
category: "parse",
description: "error description content",
location: {
path: {
File: {
PathAndId: {
file_id: 0,
path: "file.js",
},
},
},
source_code: null,
span: [31, 37],
},
message: [
{
content: "error message content",
elements: [],
},
],
severity: "Error",
source: null,
tags: [],
verbose_advices: {
advices: [],
},
});

printer.print({
"advices": {
"advices": [],
},
"category": "parse",
"description": "error description content",
"location": {
"path": {
"File": {
"PathAndId": {
"file_id": 0,
"path": "file.js",
},
},
},
"source_code": null,
"span": [
46,
58,
],
},
"message": [
{
"content": "error message content",
"elements": [],
},
],
"severity": "Error",
"source": null,
"tags": [],
"verbose_advices": {
"advices": [],
},
});
printer.print({
advices: {
advices: [],
},
category: "parse",
description: "error description content",
location: {
path: {
File: {
PathAndId: {
file_id: 0,
path: "file.js",
},
},
},
source_code: null,
span: [46, 58],
},
message: [
{
content: "error message content",
elements: [],
},
],
severity: "Error",
source: null,
tags: [],
verbose_advices: {
advices: [],
},
});

const html = printer.finish();
expect(html).toMatchSnapshot("HTML diagnostic");;
});
const html = printer.finish();
expect(html).toMatchSnapshot("HTML diagnostic");
});
});

0 comments on commit 32b0768

Please sign in to comment.