forked from finos/architecture-as-code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpatterns.cy.ts
More file actions
52 lines (42 loc) · 1.91 KB
/
patterns.cy.ts
File metadata and controls
52 lines (42 loc) · 1.91 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
const expectedNamespace = { name: "finos", description: "FINOS namespace" };
const expectedPatternId = 1;
const expectedPatternVersion = "1.0.0";
describe('Pattern Tests', () => {
beforeEach(() => {
cy.intercept("/calm/namespaces", {"values": [expectedNamespace]});
cy.intercept("/calm/namespaces/finos/patterns", {"values": [expectedPatternId]});
cy.intercept("/calm/namespaces/finos/patterns/1/versions", {"values": [expectedPatternVersion]});
cy.intercept("/calm/namespaces/finos/patterns/1/versions/1.0.0", {
fixture: "conference-signup-pattern"
});
})
it("Displays pattern diagram by default", () => {
cy.visit("/");
cy.findByText(expectedNamespace.name).click();
cy.findByText(/patterns/i).click();
cy.findByText(/1/i).click();
cy.findByText(/1.0.0/i).click();
cy.findByRole("tab", { name: /diagram/i }).should("exist");
cy.findByRole("tab", { name: /json/i }).should("exist");
cy.get('canvas').should("exist");
})
it("Switches to JSON tab and displays pattern content", () => {
cy.visit("/");
cy.findByText(expectedNamespace.name).click();
cy.findByText(/patterns/i).click();
cy.findByText(/1/i).click();
cy.findByText(/1.0.0/i).click();
cy.findByRole("tab", { name: /json/i }).click();
cy.fixture('conference-signup-pattern').then(data => {
cy.contains(/\$schema/i).should("exist");
cy.contains(data.$schema).should("exist");
cy.contains(/\$id/i).should("exist");
cy.contains(data.$id).should("exist");
cy.contains(/title/i).should("exist");
cy.contains(data.title).should("exist");
cy.contains(/description/i).should("exist");
cy.contains(data.description).should("exist");
cy.contains(/prefixItems/i).should("exist");
});
})
})