From 096ae1265090507da3d0e0366e7a783cc886c721 Mon Sep 17 00:00:00 2001 From: khadijahazward Date: Wed, 17 Apr 2024 15:57:38 +0530 Subject: [PATCH] Update Tests --- .../io/ballerina/cli/cmd/DocCommandTest.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/DocCommandTest.java b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/DocCommandTest.java index 0c9f249c2d57..3008991ffdfa 100644 --- a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/DocCommandTest.java +++ b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/DocCommandTest.java @@ -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.")