@@ -63,6 +63,87 @@ void main() {
63
63
FeatureFlags : () => TestFeatureFlags (isWebEnabled: false ),
64
64
});
65
65
66
+ testUsingContext ('precache downloads macOS artifacts on dev branch when macOS is enabled.' , () async {
67
+ final PrecacheCommand command = PrecacheCommand ();
68
+ applyMocksToCommand (command);
69
+ await createTestCommandRunner (command).run (const < String > ['precache' , '--macos' , '--no-android' , '--no-ios' ]);
70
+
71
+ expect (artifacts, unorderedEquals (< DevelopmentArtifact > {
72
+ DevelopmentArtifact .universal,
73
+ DevelopmentArtifact .macOS,
74
+ }));
75
+ }, overrides: < Type , Generator > {
76
+ Cache : () => cache,
77
+ FeatureFlags : () => TestFeatureFlags (isMacOSEnabled: true ),
78
+ });
79
+
80
+ testUsingContext ('precache does not download macOS artifacts on dev branch when feature is enabled.' , () async {
81
+ final PrecacheCommand command = PrecacheCommand ();
82
+ applyMocksToCommand (command);
83
+ await createTestCommandRunner (command).run (const < String > ['precache' , '--macos' , '--no-android' , '--no-ios' ]);
84
+
85
+ expect (artifacts, unorderedEquals (< DevelopmentArtifact > {
86
+ DevelopmentArtifact .universal,
87
+ }));
88
+ }, overrides: < Type , Generator > {
89
+ Cache : () => cache,
90
+ FeatureFlags : () => TestFeatureFlags (isMacOSEnabled: false ),
91
+ });
92
+
93
+ testUsingContext ('precache downloads Windows artifacts on dev branch when feature is enabled.' , () async {
94
+ final PrecacheCommand command = PrecacheCommand ();
95
+ applyMocksToCommand (command);
96
+ await createTestCommandRunner (command).run (const < String > ['precache' , '--windows' , '--no-android' , '--no-ios' ]);
97
+
98
+ expect (artifacts, unorderedEquals (< DevelopmentArtifact > {
99
+ DevelopmentArtifact .universal,
100
+ DevelopmentArtifact .windows,
101
+ }));
102
+ }, overrides: < Type , Generator > {
103
+ Cache : () => cache,
104
+ FeatureFlags : () => TestFeatureFlags (isWindowsEnabled: true ),
105
+ });
106
+
107
+ testUsingContext ('precache does not download Windows artifacts on dev branch when feature is enabled.' , () async {
108
+ final PrecacheCommand command = PrecacheCommand ();
109
+ applyMocksToCommand (command);
110
+ await createTestCommandRunner (command).run (const < String > ['precache' , '--windows' , '--no-android' , '--no-ios' ]);
111
+
112
+ expect (artifacts, unorderedEquals (< DevelopmentArtifact > {
113
+ DevelopmentArtifact .universal,
114
+ }));
115
+ }, overrides: < Type , Generator > {
116
+ Cache : () => cache,
117
+ FeatureFlags : () => TestFeatureFlags (isWindowsEnabled: false ),
118
+ });
119
+
120
+ testUsingContext ('precache downloads Linux artifacts on dev branch when feature is enabled.' , () async {
121
+ final PrecacheCommand command = PrecacheCommand ();
122
+ applyMocksToCommand (command);
123
+ await createTestCommandRunner (command).run (const < String > ['precache' , '--linux' , '--no-android' , '--no-ios' ]);
124
+
125
+ expect (artifacts, unorderedEquals (< DevelopmentArtifact > {
126
+ DevelopmentArtifact .universal,
127
+ DevelopmentArtifact .linux,
128
+ }));
129
+ }, overrides: < Type , Generator > {
130
+ Cache : () => cache,
131
+ FeatureFlags : () => TestFeatureFlags (isLinuxEnabled: true ),
132
+ });
133
+
134
+ testUsingContext ('precache does not download Linux artifacts on dev branch when feature is enabled.' , () async {
135
+ final PrecacheCommand command = PrecacheCommand ();
136
+ applyMocksToCommand (command);
137
+ await createTestCommandRunner (command).run (const < String > ['precache' , '--linux' , '--no-android' , '--no-ios' ]);
138
+
139
+ expect (artifacts, unorderedEquals (< DevelopmentArtifact > {
140
+ DevelopmentArtifact .universal,
141
+ }));
142
+ }, overrides: < Type , Generator > {
143
+ Cache : () => cache,
144
+ FeatureFlags : () => TestFeatureFlags (isLinuxEnabled: false ),
145
+ });
146
+
66
147
testUsingContext ('precache exits if requesting mismatched artifacts.' , () async {
67
148
final PrecacheCommand command = PrecacheCommand ();
68
149
applyMocksToCommand (command);
@@ -107,7 +188,12 @@ void main() {
107
188
}));
108
189
}, overrides: < Type , Generator > {
109
190
Cache : () => cache,
110
- FeatureFlags : () => TestFeatureFlags (isWebEnabled: true ),
191
+ FeatureFlags : () => TestFeatureFlags (
192
+ isWebEnabled: true ,
193
+ isLinuxEnabled: true ,
194
+ isMacOSEnabled: true ,
195
+ isWindowsEnabled: true ,
196
+ ),
111
197
FlutterVersion : () => masterFlutterVersion,
112
198
});
113
199
0 commit comments