forked from mage-os/github-actions
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget-matrix-for-kind.spec.ts
More file actions
138 lines (104 loc) · 4.99 KB
/
get-matrix-for-kind.spec.ts
File metadata and controls
138 lines (104 loc) · 4.99 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
import { getMatrixForKind } from "./get-matrix-for-kind";
describe('getMatrixForKind for mage-os', () => {
const project = "mage-os";
it('returns a matrix for `latest`', () => {
const result = getMatrixForKind("latest", project);
expect(result.magento).toBeDefined();
expect(result.include).toBeDefined();
});
it('returns a single-element matrix for with a matrix "magento" for `latest`', () => {
const result = getMatrixForKind("latest", project);
expect(result.magento.length).toEqual(1);
expect(result.include.length).toEqual(1);
expect(result.magento[0]).toEqual(result.include[0].magento);
});
it('returns a matrix for `currently-supported`', () => {
const result = getMatrixForKind("currently-supported", project);
expect(result.magento).toBeDefined();
expect(result.include).toBeDefined();
});
it('returns a matrix for `all`', () => {
const result = getMatrixForKind("all", project);
expect(result.magento).toBeDefined();
expect(result.include).toBeDefined();
});
it('returns a matrix for valid `custom`', () => {
const result = getMatrixForKind("custom", project, "mage-os/project-community-edition:1.0.0");
expect(result.magento).toBeDefined();
expect(result.include).toBeDefined();
expect(result.magento[0]).toBe('mage-os/project-community-edition:1.0.0');
});
it('returns a matrix nightly`', () => {
const result = getMatrixForKind("nightly", project);
expect(result.magento).toBeDefined();
expect(result.include).toBeDefined();
expect(result.magento[0]).toBe('mage-os/project-community-edition:@alpha');
});
it('returns a matrix for the next release when using `nightly`', () => {
const result = getMatrixForKind("nightly", project, "mage-os/project-community-edition:next");
expect(result.magento).toBeDefined();
expect(result.include).toBeDefined();
});
it('returns a single-element matrix for with a matrix "magento" for `nightly`', () => {
const result = getMatrixForKind("nightly", project);
expect(result.magento.length).toEqual(1);
expect(result.include.length).toEqual(1);
expect(result.magento[0]).toEqual(result.include[0].magento);
});
it('errors for invalid `custom``', () => {
expect(() => getMatrixForKind("custom", project)).toThrowError();
});
})
describe('getMatrixForKind for magento-open-source', () => {
const project = "magento-open-source";
it('returns a matrix nightly`', () => {
const result = getMatrixForKind("nightly", project);
expect(result.magento).toBeDefined();
expect(result.include).toBeDefined();
});
it('returns a matrix for `latest`', () => {
const result = getMatrixForKind("latest", project);
expect(result.magento).toBeDefined();
expect(result.include).toBeDefined();
});
it('returns a single-element matrix for with a matrix "magento" for `latest`', () => {
const result = getMatrixForKind("latest", project);
expect(result.magento.length).toEqual(1);
expect(result.include.length).toEqual(1);
expect(result.magento[0]).toEqual(result.include[0].magento);
});
it('returns a matrix for `currently-supported`', () => {
const result = getMatrixForKind("currently-supported", project);
expect(result.magento).toBeDefined();
expect(result.include).toBeDefined();
});
it('returns a matrix for `all`', () => {
const result = getMatrixForKind("all", project);
expect(result.magento).toBeDefined();
expect(result.include).toBeDefined();
});
it('returns a matrix for valid `custom`', () => {
const result = getMatrixForKind("custom", project, "magento/project-community-edition:2.4.2");
expect(result.magento).toBeDefined();
expect(result.include).toBeDefined();
});
it('returns a matrix for the next release when using `nightly`', () => {
const result = getMatrixForKind("nightly", project, "magento/project-community-edition:next");
expect(result.magento).toBeDefined();
expect(result.include).toBeDefined();
});
it('returns a single-element matrix for with a matrix "magento" for `nightly`', () => {
const result = getMatrixForKind("nightly", project);
expect(result.magento.length).toEqual(1);
expect(result.include.length).toEqual(1);
expect(result.magento[0]).toEqual(result.include[0].magento);
});
it('returns a matrix for valid multiple `custom`', () => {
const result = getMatrixForKind("custom", project, "magento/project-community-edition:2.4.2,magento/project-community-edition:2.4.3");
expect(result.magento).toBeDefined();
expect(result.include).toBeDefined();
});
it('errors for invalid `custom``', () => {
expect(() => getMatrixForKind("custom", project)).toThrowError();
});
})