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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
|
'use strict';
const expect = require('chai').expect;
const templates = require(__dirname + '/../scripts/sudo-bot/template.js');
module.exports = function() {
suite('pr message', function() {
test('prMessage for lambda files', function(done) {
const commmitMsg = templates.prMessage(['a.json', 'ab/cd/ef.json', 'README.md']);
expect(commmitMsg).to.equal('🤖 Some updates to review 🤖');
done();
});
test('prMessage for MariaDB files', function(done) {
const commmitMsg = templates.prMessage(['data/mariadb-aria-server-status-variables.json']);
expect(commmitMsg).to.equal('🤖 [MariaDB] updates');
done();
});
test('prMessage for MariaDB files and merged', function(done) {
const commmitMsg = templates.prMessage([
'dist/merged-raw.json',
'dist/merged-raw.md',
'dist/merged-slim.json',
'dist/merged-ultraslim.json',
'dist/merged-ultraslim.php',
'data/mariadb-aria-server-status-variables.json',
]);
expect(commmitMsg).to.equal('🤖 [MariaDB] updates');
done();
});
test('prMessage for MariaDB files and others', function(done) {
const commmitMsg = templates.prMessage([
'a.json',
'ab/cd/ef.json',
'README.md',
'data/mariadb-aria-server-status-variables.json',
]);
expect(commmitMsg).to.equal('🤖 [MariaDB] updates 🚨🚨');
done();
});
test('prMessage for MariaDB files and others and merged', function(done) {
const commmitMsg = templates.prMessage([
'dist/merged-raw.json',
'dist/merged-raw.md',
'dist/merged-slim.json',
'dist/merged-ultraslim.json',
'dist/merged-ultraslim.php',
'a.json',
'ab/cd/ef.json',
'README.md',
'data/mariadb-aria-server-status-variables.json',
]);
expect(commmitMsg).to.equal('🤖 [MariaDB] updates 🚨🚨');
done();
});
test('prMessage for MySQL files', function(done) {
const commmitMsg = templates.prMessage(['data/mysql-server-options.json']);
expect(commmitMsg).to.equal('🤖 [MySQL] updates');
done();
});
test('prMessage for MySQL files and merged', function(done) {
const commmitMsg = templates.prMessage([
'dist/merged-raw.json',
'dist/merged-raw.md',
'dist/merged-slim.json',
'dist/merged-ultraslim.json',
'dist/merged-ultraslim.php',
'data/mysql-server-options.json',
]);
expect(commmitMsg).to.equal('🤖 [MySQL] updates');
done();
});
test('prMessage for MySQL files and others', function(done) {
const commmitMsg = templates.prMessage([
'a.json',
'ab/cd/ef.json',
'README.md',
'data/mysql-server-options.json',
]);
expect(commmitMsg).to.equal('🤖 [MySQL] updates 🚨🚨');
done();
});
test('prMessage for MySQL files and others and merged', function(done) {
const commmitMsg = templates.prMessage([
'dist/merged-raw.json',
'dist/merged-raw.md',
'dist/merged-slim.json',
'dist/merged-ultraslim.json',
'dist/merged-ultraslim.php',
'a.json',
'ab/cd/ef.json',
'README.md',
'data/mysql-server-options.json',
]);
expect(commmitMsg).to.equal('🤖 [MySQL] updates 🚨🚨');
done();
});
test('prMessage for MySQL and MariaDB files', function(done) {
const commmitMsg = templates.prMessage([
'data/mariadb-aria-server-status-variables.json',
'data/mysql-server-options.json',
]);
expect(commmitMsg).to.equal('🤖 [MariaDB] && [MySQL] updates');
done();
});
test('prMessage for MySQL and MariaDB files and merged', function(done) {
const commmitMsg = templates.prMessage([
'dist/merged-raw.json',
'dist/merged-raw.md',
'dist/merged-slim.json',
'dist/merged-ultraslim.json',
'dist/merged-ultraslim.php',
'data/mariadb-aria-server-status-variables.json',
'data/mysql-server-options.json',
]);
expect(commmitMsg).to.equal('🤖 [MariaDB] && [MySQL] updates');
done();
});
test('prMessage for MySQL and MariaDB files and others', function(done) {
const commmitMsg = templates.prMessage([
'a.json',
'ab/cd/ef.json',
'README.md',
'data/mariadb-aria-server-status-variables.json',
'data/mysql-server-options.json',
]);
expect(commmitMsg).to.equal('🤖 [MariaDB] && [MySQL] updates 🚨🚨');
done();
});
});
suite('commit message', function() {
test('commitMessage for lambda files', function(done) {
const commmitMsg = templates.commitMessage(['a.json', 'ab/cd/ef.json', 'README.md']);
expect(commmitMsg).to.equal('update: 🤖 Some updates 🤖');
done();
});
test('commitMessage for MariaDB files', function(done) {
const commmitMsg = templates.commitMessage(['data/mariadb-aria-server-status-variables.json']);
expect(commmitMsg).to.equal('update: [MariaDB] updates');
done();
});
test('commitMessage for MariaDB files and others', function(done) {
const commmitMsg = templates.commitMessage([
'a.json',
'ab/cd/ef.json',
'README.md',
'data/mariadb-aria-server-status-variables.json',
]);
expect(commmitMsg).to.equal('update: [MariaDB] updates and other changes');
done();
});
test('commitMessage for MySQL files', function(done) {
const commmitMsg = templates.commitMessage(['data/mysql-server-options.json']);
expect(commmitMsg).to.equal('update: [MySQL] updates');
done();
});
test('commitMessage for MySQL files and others', function(done) {
const commmitMsg = templates.commitMessage([
'a.json',
'ab/cd/ef.json',
'README.md',
'data/mysql-server-options.json',
]);
expect(commmitMsg).to.equal('update: [MySQL] updates and other changes');
done();
});
test('commitMessage for MySQL and MariaDB files', function(done) {
const commmitMsg = templates.commitMessage([
'data/mariadb-aria-server-status-variables.json',
'data/mysql-server-options.json',
]);
expect(commmitMsg).to.equal('update: [MariaDB] && [MySQL] updates');
done();
});
test('commitMessage for MySQL and MariaDB files and others', function(done) {
const commmitMsg = templates.commitMessage([
'a.json',
'ab/cd/ef.json',
'README.md',
'data/mariadb-aria-server-status-variables.json',
'data/mysql-server-options.json',
]);
expect(commmitMsg).to.equal('update: [MariaDB] && [MySQL] updates and other changes');
done();
});
});
suite('pr', function() {
test('prContent', function(done) {
const prContent = templates.prContent([
'a.json',
'ab/cd/ef.json',
'data/mariadb-aria-server-status-variables.json',
'dist/merged-raw.json',
'dist/merged-raw.md',
'dist/merged-slim.json',
'dist/merged-ultraslim.json',
'dist/merged-ultraslim.php',
'data/mysql-server-options.json',
'README.md',
]);
expect(prContent).to.equal(
'Dear human 🌻, after running my task the following files where updated:\n- `a.json` 👽\n- `ab/cd/ef.json` 👽\n- `data/mariadb-aria-server-status-variables.json` 🐳\n- `dist/merged-raw.json` 📦\n- `dist/merged-raw.md` 📦\n- `dist/merged-slim.json` 📦\n- `dist/merged-ultraslim.json` 📦\n- `dist/merged-ultraslim.php` 📦\n- `data/mysql-server-options.json` 🐬\n- `README.md` 👽\n'
);
done();
});
test('prContent one file', function(done) {
const prContent = templates.prContent(['README.md']);
expect(prContent).to.equal(
'Dear human 🌻, after running my task the following file was updated:\n- `README.md` 👽\n'
);
done();
});
test('prBranch', function(done) {
const prBranch = templates.prBranch([]);
expect(prBranch).to.match(/^refs\/heads\/update\/[0-9]{13}$/);
done();
});
});
};
|