diff options
| author | Alban Auzeill | 2019-12-23 14:38:46 +0100 | 
|---|---|---|
| committer | Elena Vilchik | 2019-12-23 14:38:46 +0100 | 
| commit | e1084ab0bee42625105ff332365b05ab30654d47 (patch) | |
| tree | 56ed1f1d404b378db88e334294f2ba3a5022c72b /sonar-css-plugin/css-bundle/tests | |
| parent | 0161362db5e83f700dded8ff052b358a3f478640 (diff) | |
| download | sonar-css-e1084ab0bee42625105ff332365b05ab30654d47.tar.bz2 | |
Send file content to NodeJS process if encoding not UFT-8 (#224)
Diffstat (limited to 'sonar-css-plugin/css-bundle/tests')
| -rw-r--r-- | sonar-css-plugin/css-bundle/tests/server.test.ts | 16 | 
1 files changed, 16 insertions, 0 deletions
| diff --git a/sonar-css-plugin/css-bundle/tests/server.test.ts b/sonar-css-plugin/css-bundle/tests/server.test.ts index 8465810..84fc617 100644 --- a/sonar-css-plugin/css-bundle/tests/server.test.ts +++ b/sonar-css-plugin/css-bundle/tests/server.test.ts @@ -147,6 +147,22 @@ describe("server", () => {      );    }); +  it("should use fileContent from the request and not from the filesystem", async () => { +    const request = JSON.stringify({ +      filePath: path.join(__dirname, "fixtures", "file.css"), +      fileContent: "\n\n a { }", // move the issue on line 3 +      configFile +    }); +    const response = await post(request, "/analyze"); +    expect(JSON.parse(response)).toEqual([ +      { +        line: 3, +        rule: "block-no-empty", +        text: "Unexpected empty block (block-no-empty)" +      } +    ]); +  }); +    function post(data: string, endpoint: string): Promise<string> {      return postToServer(data, endpoint, server);    } | 
