-
Notifications
You must be signed in to change notification settings - Fork 86
Expand file tree
/
Copy pathLlmContentTest.java
More file actions
57 lines (48 loc) · 2.1 KB
/
LlmContentTest.java
File metadata and controls
57 lines (48 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS;
import org.htmlunit.Page;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.jvnet.hudson.test.JenkinsRule;
import org.jvnet.hudson.test.junit.jupiter.WithJenkins;
@WithJenkins
@TestInstance(PER_CLASS)
class LlmContentTest {
private JenkinsRule jenkins;
@BeforeAll
void beforeAll(JenkinsRule jenkins) {
this.jenkins = jenkins;
}
@Test
void llmsTxtContainsIndex() throws Exception {
try (var webClient = jenkins.createWebClient()) {
Page page = webClient.getPage(jenkins.getURL() + "design-library/llms.txt");
String content = page.getWebResponse().getContentAsString();
assertThat(content).startsWith("# Jenkins Design Library");
assertThat(content).contains("## Components");
assertThat(content).contains("## Patterns");
assertThat(content).contains("Buttons");
}
}
@Test
void llmsAllTxtContainsAllComponents() throws Exception {
try (var webClient = jenkins.createWebClient()) {
Page page = webClient.getPage(jenkins.getURL() + "design-library/llms-all.txt");
String content = page.getWebResponse().getContentAsString();
assertThat(content).startsWith("# Jenkins Design Library");
assertThat(content).contains("# Buttons");
assertThat(content).contains("# Cards");
assertThat(content).contains("# Colors");
}
}
@Test
void existingComponentPagesStillWork() throws Exception {
try (var webClient = jenkins.createWebClient().withJavaScriptEnabled(false)) {
webClient.getOptions().setThrowExceptionOnFailingStatusCode(false);
webClient.getOptions().setPrintContentOnFailingStatusCode(false);
Page page = webClient.getPage(jenkins.getURL() + "design-library/buttons");
assertThat(page.getWebResponse().getStatusCode()).isEqualTo(200);
}
}
}