@@ -21,6 +21,10 @@ void main() {
21
21
expect (TestCommand (BuildCommandRunner ()).name, "test" );
22
22
});
23
23
24
+ test ('deploy' , () {
25
+ expect (DeployCommand (BuildCommandRunner ()).name, "deploy" );
26
+ });
27
+
24
28
test ('generate' , () {
25
29
expect (GenerateCommand (BuildCommandRunner ()).name, "generate" );
26
30
});
@@ -83,6 +87,13 @@ void main() {
83
87
});
84
88
});
85
89
90
+ test ('deploy' , () async {
91
+ var runner = makeTestRunner ();
92
+ await runner.run (["-r19" , "-d../.." , "deploy" ]).whenComplete (() {
93
+ buildSpecAssertions (runner, "deploy" );
94
+ });
95
+ });
96
+
86
97
test ('verify' , () async {
87
98
var runner = makeTestRunner ();
88
99
await runner.run (["-r19" , "-d../.." , "verify" ]).whenComplete (() {
@@ -91,6 +102,75 @@ void main() {
91
102
});
92
103
});
93
104
105
+ group ('release' , () {
106
+ test ('simple' , () async {
107
+ var runner = makeTestRunner ();
108
+ late TestDeployCommand cmd;
109
+ await runner.run (["-r19" , "-d../.." , "deploy" ]).whenComplete (() {
110
+ cmd = (runner.commands['deploy' ] as TestDeployCommand );
111
+ });
112
+ expect (cmd.isReleaseValid, true );
113
+ });
114
+
115
+ test ('minor' , () async {
116
+ var runner = makeTestRunner ();
117
+ late TestDeployCommand cmd;
118
+ await runner.run (["-r19.2" , "-d../.." , "deploy" ]).whenComplete (() {
119
+ cmd = (runner.commands['deploy' ] as TestDeployCommand );
120
+ });
121
+ expect (cmd.isReleaseValid, true );
122
+ });
123
+
124
+ test ('patch invalid' , () async {
125
+ var runner = makeTestRunner ();
126
+ late TestDeployCommand cmd;
127
+ await runner.run (["-r19.2.1" , "-d../.." , "deploy" ]).whenComplete (() {
128
+ cmd = (runner.commands['deploy' ] as TestDeployCommand );
129
+ });
130
+ expect (cmd.isReleaseValid, false );
131
+ });
132
+
133
+ test ('non-numeric' , () async {
134
+ var runner = makeTestRunner ();
135
+ late TestDeployCommand cmd;
136
+ await runner.run (["-rx19.2" , "-d../.." , "deploy" ]).whenComplete (() {
137
+ cmd = (runner.commands['deploy' ] as TestDeployCommand );
138
+ });
139
+ expect (cmd.isReleaseValid, false );
140
+ });
141
+ });
142
+
143
+ group ('deploy' , () {
144
+ test ('clean' , () async {
145
+ var dir = Directory .current;
146
+ var runner = makeTestRunner ();
147
+ await runner
148
+ .run (["-r=19" , "-d../.." , "deploy" , "--no-as" , "--no-ij" ])
149
+ .whenComplete (() {
150
+ expect (Directory .current.path, equals (dir.path));
151
+ });
152
+ });
153
+
154
+ test ('without --release' , () async {
155
+ var runner = makeTestRunner ();
156
+ late TestDeployCommand cmd;
157
+ await runner.run (["-d../.." , "deploy" ]).whenComplete (() {
158
+ cmd = (runner.commands['deploy' ] as TestDeployCommand );
159
+ });
160
+ expect (cmd.paths, orderedEquals ([]));
161
+ });
162
+
163
+ test ('release paths' , () async {
164
+ var runner = makeTestRunner ();
165
+ late TestDeployCommand cmd;
166
+ await runner.run (["--release=19" , "-d../.." , "deploy" ]).whenComplete (() {
167
+ cmd = (runner.commands['deploy' ] as TestDeployCommand );
168
+ });
169
+ var specs = cmd.specs.where ((s) => s.isStableChannel).toList ();
170
+ expect (cmd.paths.length, specs.length);
171
+ });
172
+ });
173
+
94
174
group ('build' , () {
95
175
test ('plugin.xml' , () async {
96
176
var runner = makeTestRunner ();
@@ -175,11 +255,41 @@ BuildCommandRunner makeTestRunner() {
175
255
var runner = BuildCommandRunner ();
176
256
runner.addCommand (TestMakeCommand (runner));
177
257
runner.addCommand (TestTestCommand (runner));
258
+ runner.addCommand (TestDeployCommand (runner));
178
259
runner.addCommand (TestGenCommand (runner));
179
260
runner.addCommand (TestVerifyCommand (runner));
180
261
return runner;
181
262
}
182
263
264
+ class TestDeployCommand extends DeployCommand {
265
+ List <String > paths = < String > [];
266
+ List <String > plugins = < String > [];
267
+
268
+ TestDeployCommand (super .runner);
269
+
270
+ @override
271
+ bool get isTesting => true ;
272
+
273
+ @override
274
+ void changeDirectory (Directory dir) {}
275
+
276
+ String readTokenFile () {
277
+ return "token" ;
278
+ }
279
+
280
+ @override
281
+ Future <int > upload (
282
+ String filePath,
283
+ String pluginNumber,
284
+ String token,
285
+ String channel,
286
+ ) {
287
+ paths.add (filePath);
288
+ plugins.add (pluginNumber);
289
+ return Future (() => 0 );
290
+ }
291
+ }
292
+
183
293
class TestGenCommand extends GenerateCommand {
184
294
TestGenCommand (super .runner);
185
295
0 commit comments