feat(shorebird_cli): expose flutter_revision on release (#475)

This commit is contained in:
Felix Angelov
2023-05-12 09:40:59 -07:00
committed by GitHub
parent 38cb754809
commit c835c4b02e
8 changed files with 40 additions and 3 deletions
@@ -70,6 +70,7 @@ void main() {
id: 0,
appId: appId,
version: version,
flutterRevision: '83305b5088e6fe327fb3334a73ff190828d85713',
displayName: '1.2.3+1',
);
const patch = Patch(id: 0, number: 1);
@@ -52,6 +52,7 @@ void main() {
id: 0,
appId: appId,
version: version,
flutterRevision: '83305b5088e6fe327fb3334a73ff190828d85713',
displayName: '1.2.3+1',
);
const releaseArtifact = ReleaseArtifact(
@@ -25,6 +25,7 @@ class _MockProgress extends Mock implements Progress {}
void main() {
group(DeleteReleasesCommand, () {
const appId = 'test-app-id';
const flutterRevision = '83305b5088e6fe327fb3334a73ff190828d85713';
const releaseId = 3;
const versionNumber = '1.0.0';
@@ -87,18 +88,21 @@ flutter:
id: 1,
appId: appId,
version: '0.1.0',
flutterRevision: flutterRevision,
displayName: null,
),
const Release(
id: 2,
appId: appId,
version: '0.1.1',
flutterRevision: flutterRevision,
displayName: null,
),
const Release(
id: releaseId,
appId: appId,
version: versionNumber,
flutterRevision: flutterRevision,
displayName: null,
),
],
@@ -23,6 +23,8 @@ class _MockLogger extends Mock implements Logger {}
void main() {
group(ListReleasesCommand, () {
const appId = 'test-app-id';
const flutterRevision = '83305b5088e6fe327fb3334a73ff190828d85713';
late ArgResults argResults;
late Auth auth;
late http.Client httpClient;
@@ -139,6 +141,7 @@ flavors:
id: 1,
appId: appId,
version: '1.0.0',
flutterRevision: flutterRevision,
displayName: 'v1.0.0 (dev)',
),
],
@@ -170,12 +173,14 @@ flavors:
id: 1,
appId: appId,
version: '1.0.1',
flutterRevision: flutterRevision,
displayName: 'First',
),
const Release(
id: 1,
appId: appId,
version: '1.0.2',
flutterRevision: flutterRevision,
displayName: null,
),
],
@@ -15,6 +15,7 @@ class _FakeBaseRequest extends Fake implements http.BaseRequest {}
void main() {
group('CodePushClient', () {
const appId = 'app-id';
const flutterRevision = '83305b5088e6fe327fb3334a73ff190828d85713';
const displayName = 'shorebird-example';
const errorResponse = ErrorResponse(
code: 'test_code',
@@ -738,6 +739,7 @@ void main() {
id: releaseId,
appId: appId,
version: version,
flutterRevision: flutterRevision,
displayName: displayName,
),
),
@@ -1205,8 +1207,20 @@ void main() {
test('completes when request succeeds (populated)', () async {
final expected = [
Release(id: 0, appId: '1', version: '1.0.0', displayName: 'v1.0.0'),
Release(id: 1, appId: '2', version: '1.0.1', displayName: 'v1.0.1'),
Release(
id: 0,
appId: '1',
version: '1.0.0',
flutterRevision: flutterRevision,
displayName: 'v1.0.0',
),
Release(
id: 1,
appId: '2',
version: '1.0.1',
flutterRevision: flutterRevision,
displayName: 'v1.0.1',
),
];
when(
@@ -13,6 +13,7 @@ class Release {
required this.id,
required this.appId,
required this.version,
required this.flutterRevision,
required this.displayName,
});
@@ -32,6 +33,9 @@ class Release {
/// The version of the release.
final String version;
/// The Flutter revision used to create the release.
final String flutterRevision;
/// The display name for the release
final String? displayName;
}
@@ -16,16 +16,23 @@ Release _$ReleaseFromJson(Map<String, dynamic> json) => $checkedCreate(
id: $checkedConvert('id', (v) => v as int),
appId: $checkedConvert('app_id', (v) => v as String),
version: $checkedConvert('version', (v) => v as String),
flutterRevision:
$checkedConvert('flutter_revision', (v) => v as String),
displayName: $checkedConvert('display_name', (v) => v as String?),
);
return val;
},
fieldKeyMap: const {'appId': 'app_id', 'displayName': 'display_name'},
fieldKeyMap: const {
'appId': 'app_id',
'flutterRevision': 'flutter_revision',
'displayName': 'display_name'
},
);
Map<String, dynamic> _$ReleaseToJson(Release instance) => <String, dynamic>{
'id': instance.id,
'app_id': instance.appId,
'version': instance.version,
'flutter_revision': instance.flutterRevision,
'display_name': instance.displayName,
};
@@ -8,6 +8,7 @@ void main() {
id: 1,
appId: 'app-id',
version: '1.0.0',
flutterRevision: '83305b5088e6fe327fb3334a73ff190828d85713',
displayName: 'v1.0.0',
);
expect(