Skip to content

Commit

Permalink
Merge pull request ballerina-platform#42572 from khadijahazward/master
Browse files Browse the repository at this point in the history
Update Tests for the `bal doc` Command
  • Loading branch information
keizer619 authored Sep 8, 2024
2 parents a6a3526 + 096ae12 commit d2448ce
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,23 @@ public void setup() throws IOException {
}

@Test(description = "Test doc command on a ballerina project.")
public void testDocCommand() throws IOException {
public void testDocCommand() {
Path projectPath = this.testResources.resolve("doc_project");
System.setProperty("user.dir", projectPath.toString());
Path destinationPath = projectPath.resolve("target")
.resolve("apidocs").resolve("foo").resolve("winery").resolve("0.1.0");
DocCommand docCommand = new DocCommand(this.printStream, this.printStream, false);
docCommand.execute();

Assert.assertTrue(Files.exists(this.testResources.resolve("doc_project").resolve("target")
.resolve("apidocs").resolve("foo").resolve("winery").resolve("0.1.0").resolve("index.html")));
Assert.assertTrue(Files.exists(destinationPath.resolve("api-docs.js")));
Assert.assertTrue(Files.exists(destinationPath.resolve("api-docs.json")));

Files.delete(this.testResources.resolve("doc_project").resolve("target")
.resolve("apidocs").resolve("foo").resolve("winery").resolve("0.1.0").resolve("index.html"));
/* Verify if all the UI components are present. */
Assert.assertTrue(Files.exists(destinationPath.resolve("bundle.js")));
Assert.assertTrue(Files.exists(destinationPath.resolve("favicon.ico")));
Assert.assertTrue(Files.exists(destinationPath.resolve("globals.css")));
Assert.assertTrue(Files.exists(destinationPath.resolve("index.html")));
Assert.assertTrue(Files.exists(destinationPath.resolve("vercel.svg")));
}

@Test(description = "Test doc command on a ballerina project with custom target dir.")
Expand Down

0 comments on commit d2448ce

Please sign in to comment.