refactor(code_push_protocol): move upload urls to artifact responses (#583)
This commit is contained in:
-1
@@ -1 +0,0 @@
|
||||
export 'create_artifact_request.dart';
|
||||
+1
-9
@@ -1,5 +1,4 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:shorebird_code_push_protocol/shorebird_code_push_protocol.dart';
|
||||
|
||||
part 'create_patch_response.g.dart';
|
||||
|
||||
@@ -9,11 +8,7 @@ part 'create_patch_response.g.dart';
|
||||
@JsonSerializable()
|
||||
class CreatePatchResponse {
|
||||
/// {@macro create_patch_response}
|
||||
const CreatePatchResponse({
|
||||
required this.id,
|
||||
required this.number,
|
||||
required this.artifactUploadUrls,
|
||||
});
|
||||
const CreatePatchResponse({required this.id, required this.number});
|
||||
|
||||
/// Converts a Map<String, dynamic> to a [CreatePatchResponse]
|
||||
factory CreatePatchResponse.fromJson(Map<String, dynamic> json) =>
|
||||
@@ -28,7 +23,4 @@ class CreatePatchResponse {
|
||||
/// The patch number.
|
||||
/// A larger number equates to a newer patch.
|
||||
final int number;
|
||||
|
||||
/// The upload urls for artifacts.
|
||||
final ArtifactUploadUrls artifactUploadUrls;
|
||||
}
|
||||
|
||||
-4
@@ -16,12 +16,9 @@ CreatePatchResponse _$CreatePatchResponseFromJson(Map<String, dynamic> json) =>
|
||||
final val = CreatePatchResponse(
|
||||
id: $checkedConvert('id', (v) => v as int),
|
||||
number: $checkedConvert('number', (v) => v as int),
|
||||
artifactUploadUrls: $checkedConvert('artifact_upload_urls',
|
||||
(v) => ArtifactUploadUrls.fromJson(v as Map<String, dynamic>)),
|
||||
);
|
||||
return val;
|
||||
},
|
||||
fieldKeyMap: const {'artifactUploadUrls': 'artifact_upload_urls'},
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$CreatePatchResponseToJson(
|
||||
@@ -29,5 +26,4 @@ Map<String, dynamic> _$CreatePatchResponseToJson(
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'number': instance.number,
|
||||
'artifact_upload_urls': instance.artifactUploadUrls.toJson(),
|
||||
};
|
||||
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
export 'create_patch_artifact_request.dart';
|
||||
export 'create_patch_artifact_response.dart';
|
||||
+10
-10
@@ -1,27 +1,27 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:shorebird_code_push_protocol/shorebird_code_push_protocol.dart';
|
||||
|
||||
part 'create_artifact_request.g.dart';
|
||||
part 'create_patch_artifact_request.g.dart';
|
||||
|
||||
/// {@template create_artifact_request}
|
||||
/// The request body for POST /api/v1/artifacts
|
||||
/// {@template create_patch_artifact_request}
|
||||
/// The request body for POST /api/v1/patches/<id>/artifacts
|
||||
/// {@endtemplate}
|
||||
@JsonSerializable()
|
||||
class CreateArtifactRequest {
|
||||
class CreatePatchArtifactRequest {
|
||||
/// {@macro create_artifact_request}
|
||||
const CreateArtifactRequest({
|
||||
const CreatePatchArtifactRequest({
|
||||
required this.arch,
|
||||
required this.platform,
|
||||
required this.hash,
|
||||
required this.size,
|
||||
});
|
||||
|
||||
/// Converts a Map<String, dynamic> to a [CreateArtifactRequest]
|
||||
factory CreateArtifactRequest.fromJson(Map<String, dynamic> json) =>
|
||||
_$CreateArtifactRequestFromJson(json);
|
||||
/// Converts a Map<String, dynamic> to a [CreatePatchArtifactRequest]
|
||||
factory CreatePatchArtifactRequest.fromJson(Map<String, dynamic> json) =>
|
||||
_$CreatePatchArtifactRequestFromJson(json);
|
||||
|
||||
/// Converts a [CreateArtifactRequest] to a Map<String, dynamic>.
|
||||
Json toJson() => _$CreateArtifactRequestToJson(this);
|
||||
/// Converts a [CreatePatchArtifactRequest] to a Map<String, dynamic>.
|
||||
Json toJson() => _$CreatePatchArtifactRequestToJson(this);
|
||||
|
||||
/// The arch of the artifact.
|
||||
final String arch;
|
||||
+8
-8
@@ -2,34 +2,34 @@
|
||||
|
||||
// ignore_for_file: implicit_dynamic_parameter, require_trailing_commas, cast_nullable_to_non_nullable, lines_longer_than_80_chars
|
||||
|
||||
part of 'create_artifact_request.dart';
|
||||
part of 'create_patch_artifact_request.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
CreateArtifactRequest _$CreateArtifactRequestFromJson(
|
||||
CreatePatchArtifactRequest _$CreatePatchArtifactRequestFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
$checkedCreate(
|
||||
'CreateArtifactRequest',
|
||||
'CreatePatchArtifactRequest',
|
||||
json,
|
||||
($checkedConvert) {
|
||||
final val = CreateArtifactRequest(
|
||||
final val = CreatePatchArtifactRequest(
|
||||
arch: $checkedConvert('arch', (v) => v as String),
|
||||
platform: $checkedConvert('platform', (v) => v as String),
|
||||
hash: $checkedConvert('hash', (v) => v as String),
|
||||
size: $checkedConvert(
|
||||
'size', (v) => CreateArtifactRequest._parseStringToInt(v)),
|
||||
'size', (v) => CreatePatchArtifactRequest._parseStringToInt(v)),
|
||||
);
|
||||
return val;
|
||||
},
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$CreateArtifactRequestToJson(
|
||||
CreateArtifactRequest instance) =>
|
||||
Map<String, dynamic> _$CreatePatchArtifactRequestToJson(
|
||||
CreatePatchArtifactRequest instance) =>
|
||||
<String, dynamic>{
|
||||
'arch': instance.arch,
|
||||
'platform': instance.platform,
|
||||
'hash': instance.hash,
|
||||
'size': CreateArtifactRequest._parseIntToString(instance.size),
|
||||
'size': CreatePatchArtifactRequest._parseIntToString(instance.size),
|
||||
};
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:shorebird_code_push_protocol/shorebird_code_push_protocol.dart';
|
||||
|
||||
part 'create_patch_artifact_response.g.dart';
|
||||
|
||||
/// {@template create_patch_artifact_response}
|
||||
/// The response body for POST /api/v1/patches/<id>/artifacts
|
||||
/// {@endtemplate}
|
||||
@JsonSerializable()
|
||||
class CreatePatchArtifactResponse {
|
||||
/// {@macro create_artifact_response}
|
||||
const CreatePatchArtifactResponse({
|
||||
required this.arch,
|
||||
required this.platform,
|
||||
required this.hash,
|
||||
required this.size,
|
||||
required this.url,
|
||||
});
|
||||
|
||||
/// Converts a Map<String, dynamic> to a [CreatePatchArtifactResponse]
|
||||
factory CreatePatchArtifactResponse.fromJson(Map<String, dynamic> json) =>
|
||||
_$CreatePatchArtifactResponseFromJson(json);
|
||||
|
||||
/// Converts a [CreatePatchArtifactResponse] to a Map<String, dynamic>.
|
||||
Json toJson() => _$CreatePatchArtifactResponseToJson(this);
|
||||
|
||||
/// The arch of the artifact.
|
||||
final String arch;
|
||||
|
||||
/// The platform of the artifact.
|
||||
final String platform;
|
||||
|
||||
/// The hash of the artifact.
|
||||
final String hash;
|
||||
|
||||
/// The size of the artifact in bytes.
|
||||
@JsonKey(fromJson: _parseStringToInt, toJson: _parseIntToString)
|
||||
final int size;
|
||||
|
||||
/// The upload URL for the artifact.
|
||||
final String url;
|
||||
|
||||
static int _parseStringToInt(dynamic value) => int.parse(value as String);
|
||||
|
||||
static String _parseIntToString(dynamic value) => value.toString();
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
// ignore_for_file: implicit_dynamic_parameter, require_trailing_commas, cast_nullable_to_non_nullable, lines_longer_than_80_chars
|
||||
|
||||
part of 'create_patch_artifact_response.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
CreatePatchArtifactResponse _$CreatePatchArtifactResponseFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
$checkedCreate(
|
||||
'CreatePatchArtifactResponse',
|
||||
json,
|
||||
($checkedConvert) {
|
||||
final val = CreatePatchArtifactResponse(
|
||||
arch: $checkedConvert('arch', (v) => v as String),
|
||||
platform: $checkedConvert('platform', (v) => v as String),
|
||||
hash: $checkedConvert('hash', (v) => v as String),
|
||||
size: $checkedConvert(
|
||||
'size', (v) => CreatePatchArtifactResponse._parseStringToInt(v)),
|
||||
url: $checkedConvert('url', (v) => v as String),
|
||||
);
|
||||
return val;
|
||||
},
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$CreatePatchArtifactResponseToJson(
|
||||
CreatePatchArtifactResponse instance) =>
|
||||
<String, dynamic>{
|
||||
'arch': instance.arch,
|
||||
'platform': instance.platform,
|
||||
'hash': instance.hash,
|
||||
'size': CreatePatchArtifactResponse._parseIntToString(instance.size),
|
||||
'url': instance.url,
|
||||
};
|
||||
-5
@@ -1,5 +1,4 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:shorebird_code_push_protocol/shorebird_code_push_protocol.dart';
|
||||
|
||||
part 'create_release_response.g.dart';
|
||||
|
||||
@@ -15,7 +14,6 @@ class CreateReleaseResponse {
|
||||
required this.version,
|
||||
required this.flutterRevision,
|
||||
required this.displayName,
|
||||
required this.artifactUploadUrls,
|
||||
});
|
||||
|
||||
/// Converts a Map<String, dynamic> to a [CreateReleaseResponse]
|
||||
@@ -39,7 +37,4 @@ class CreateReleaseResponse {
|
||||
|
||||
/// The display name for the release
|
||||
final String? displayName;
|
||||
|
||||
/// The upload urls for artifacts.
|
||||
final ArtifactUploadUrls artifactUploadUrls;
|
||||
}
|
||||
|
||||
+1
-5
@@ -21,16 +21,13 @@ CreateReleaseResponse _$CreateReleaseResponseFromJson(
|
||||
flutterRevision:
|
||||
$checkedConvert('flutter_revision', (v) => v as String),
|
||||
displayName: $checkedConvert('display_name', (v) => v as String?),
|
||||
artifactUploadUrls: $checkedConvert('artifact_upload_urls',
|
||||
(v) => ArtifactUploadUrls.fromJson(v as Map<String, dynamic>)),
|
||||
);
|
||||
return val;
|
||||
},
|
||||
fieldKeyMap: const {
|
||||
'appId': 'app_id',
|
||||
'flutterRevision': 'flutter_revision',
|
||||
'displayName': 'display_name',
|
||||
'artifactUploadUrls': 'artifact_upload_urls'
|
||||
'displayName': 'display_name'
|
||||
},
|
||||
);
|
||||
|
||||
@@ -42,5 +39,4 @@ Map<String, dynamic> _$CreateReleaseResponseToJson(
|
||||
'version': instance.version,
|
||||
'flutter_revision': instance.flutterRevision,
|
||||
'display_name': instance.displayName,
|
||||
'artifact_upload_urls': instance.artifactUploadUrls.toJson(),
|
||||
};
|
||||
|
||||
+1
@@ -1 +1,2 @@
|
||||
export 'create_release_artifact_request.dart';
|
||||
export 'create_release_artifact_response.dart';
|
||||
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:shorebird_code_push_protocol/shorebird_code_push_protocol.dart';
|
||||
|
||||
part 'create_release_artifact_response.g.dart';
|
||||
|
||||
/// {@template create_release_artifact_response}
|
||||
/// The response body for POST /api/v1/artifacts/:id/artifacts
|
||||
/// {@endtemplate}
|
||||
@JsonSerializable()
|
||||
class CreateReleaseArtifactResponse {
|
||||
/// {@macro create_release_artifact_response}
|
||||
const CreateReleaseArtifactResponse({
|
||||
required this.arch,
|
||||
required this.platform,
|
||||
required this.hash,
|
||||
required this.size,
|
||||
required this.url,
|
||||
});
|
||||
|
||||
/// Converts a Map<String, dynamic> to a [CreateReleaseArtifactResponse]
|
||||
factory CreateReleaseArtifactResponse.fromJson(Map<String, dynamic> json) =>
|
||||
_$CreateReleaseArtifactResponseFromJson(json);
|
||||
|
||||
/// Converts a [CreateReleaseArtifactResponse] to a Map<String, dynamic>.
|
||||
Json toJson() => _$CreateReleaseArtifactResponseToJson(this);
|
||||
|
||||
/// The arch of the artifact.
|
||||
final String arch;
|
||||
|
||||
/// The platform of the artifact.
|
||||
final String platform;
|
||||
|
||||
/// The hash of the artifact.
|
||||
final String hash;
|
||||
|
||||
/// The size of the artifact in bytes.
|
||||
@JsonKey(fromJson: _parseStringToInt, toJson: _parseIntToString)
|
||||
final int size;
|
||||
|
||||
/// The upload URL for the artifact.
|
||||
final String url;
|
||||
|
||||
static int _parseStringToInt(dynamic value) => int.parse(value as String);
|
||||
|
||||
static String _parseIntToString(dynamic value) => value.toString();
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
// ignore_for_file: implicit_dynamic_parameter, require_trailing_commas, cast_nullable_to_non_nullable, lines_longer_than_80_chars
|
||||
|
||||
part of 'create_release_artifact_response.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
CreateReleaseArtifactResponse _$CreateReleaseArtifactResponseFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
$checkedCreate(
|
||||
'CreateReleaseArtifactResponse',
|
||||
json,
|
||||
($checkedConvert) {
|
||||
final val = CreateReleaseArtifactResponse(
|
||||
arch: $checkedConvert('arch', (v) => v as String),
|
||||
platform: $checkedConvert('platform', (v) => v as String),
|
||||
hash: $checkedConvert('hash', (v) => v as String),
|
||||
size: $checkedConvert('size',
|
||||
(v) => CreateReleaseArtifactResponse._parseStringToInt(v)),
|
||||
url: $checkedConvert('url', (v) => v as String),
|
||||
);
|
||||
return val;
|
||||
},
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$CreateReleaseArtifactResponseToJson(
|
||||
CreateReleaseArtifactResponse instance) =>
|
||||
<String, dynamic>{
|
||||
'arch': instance.arch,
|
||||
'platform': instance.platform,
|
||||
'hash': instance.hash,
|
||||
'size': CreateReleaseArtifactResponse._parseIntToString(instance.size),
|
||||
'url': instance.url,
|
||||
};
|
||||
@@ -2,7 +2,7 @@ export 'cancel_subscription/cancel_subscription_response.dart';
|
||||
export 'check_for_patches/check_for_patches.dart';
|
||||
export 'create_app/create_app.dart';
|
||||
export 'create_app_collaborator/create_app_collaborator.dart';
|
||||
export 'create_artifact/create_artifact.dart';
|
||||
export 'create_patch_artifact/create_patch_artifact.dart';
|
||||
export 'create_channel/create_channel.dart';
|
||||
export 'create_patch/create_patch.dart';
|
||||
export 'create_payment_link/create_payment_link.dart';
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'artifact_upload_urls.g.dart';
|
||||
|
||||
/// {@template artifact_upload_urls}
|
||||
/// An object that contains signed upload URLs for artifacts.
|
||||
/// {@endtemplate}
|
||||
@JsonSerializable()
|
||||
class ArtifactUploadUrls {
|
||||
/// {@macro artifact_upload_urls}
|
||||
const ArtifactUploadUrls({required this.android});
|
||||
|
||||
/// Converts a Map<String, dynamic> to an [ArtifactUploadUrls]
|
||||
factory ArtifactUploadUrls.fromJson(Map<String, dynamic> json) =>
|
||||
_$ArtifactUploadUrlsFromJson(json);
|
||||
|
||||
/// Converts a [ArtifactUploadUrls] to a Map<String, dynamic>
|
||||
Map<String, dynamic> toJson() => _$ArtifactUploadUrlsToJson(this);
|
||||
|
||||
/// The upload urls for Android artifacts.
|
||||
final AndroidArtifactUploadUrls android;
|
||||
}
|
||||
|
||||
/// {@template android_artifact_upload_urls}
|
||||
/// An object that contains signed upload URLs for Android artifacts.
|
||||
/// {@endtemplate}
|
||||
@JsonSerializable()
|
||||
class AndroidArtifactUploadUrls {
|
||||
/// {@macro android_artifact_upload_urls}
|
||||
const AndroidArtifactUploadUrls({
|
||||
required this.x86,
|
||||
required this.aarch64,
|
||||
required this.arm,
|
||||
});
|
||||
|
||||
/// Converts a Map<String, dynamic> to an [AndroidArtifactUploadUrls]
|
||||
factory AndroidArtifactUploadUrls.fromJson(Map<String, dynamic> json) =>
|
||||
_$AndroidArtifactUploadUrlsFromJson(json);
|
||||
|
||||
/// Converts a [AndroidArtifactUploadUrls] to a Map<String, dynamic>
|
||||
Map<String, dynamic> toJson() => _$AndroidArtifactUploadUrlsToJson(this);
|
||||
|
||||
final String x86;
|
||||
final String aarch64;
|
||||
final String arm;
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
// ignore_for_file: implicit_dynamic_parameter, require_trailing_commas, cast_nullable_to_non_nullable, lines_longer_than_80_chars
|
||||
|
||||
part of 'artifact_upload_urls.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
ArtifactUploadUrls _$ArtifactUploadUrlsFromJson(Map<String, dynamic> json) =>
|
||||
$checkedCreate(
|
||||
'ArtifactUploadUrls',
|
||||
json,
|
||||
($checkedConvert) {
|
||||
final val = ArtifactUploadUrls(
|
||||
android: $checkedConvert(
|
||||
'android',
|
||||
(v) => AndroidArtifactUploadUrls.fromJson(
|
||||
v as Map<String, dynamic>)),
|
||||
);
|
||||
return val;
|
||||
},
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$ArtifactUploadUrlsToJson(ArtifactUploadUrls instance) =>
|
||||
<String, dynamic>{
|
||||
'android': instance.android.toJson(),
|
||||
};
|
||||
|
||||
AndroidArtifactUploadUrls _$AndroidArtifactUploadUrlsFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
$checkedCreate(
|
||||
'AndroidArtifactUploadUrls',
|
||||
json,
|
||||
($checkedConvert) {
|
||||
final val = AndroidArtifactUploadUrls(
|
||||
x86: $checkedConvert('x86', (v) => v as String),
|
||||
aarch64: $checkedConvert('aarch64', (v) => v as String),
|
||||
arm: $checkedConvert('arm', (v) => v as String),
|
||||
);
|
||||
return val;
|
||||
},
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$AndroidArtifactUploadUrlsToJson(
|
||||
AndroidArtifactUploadUrls instance) =>
|
||||
<String, dynamic>{
|
||||
'x86': instance.x86,
|
||||
'aarch64': instance.aarch64,
|
||||
'arm': instance.arm,
|
||||
};
|
||||
@@ -1,6 +1,5 @@
|
||||
export 'app.dart';
|
||||
export 'app_metadata.dart';
|
||||
export 'artifact_upload_urls.dart';
|
||||
export 'channel.dart';
|
||||
export 'collaborator.dart';
|
||||
export 'error_response.dart';
|
||||
|
||||
+1
-11
@@ -4,17 +4,7 @@ import 'package:test/test.dart';
|
||||
void main() {
|
||||
group(CreatePatchResponse, () {
|
||||
test('can be (de)serialized', () {
|
||||
const response = CreatePatchResponse(
|
||||
id: 42,
|
||||
number: 1,
|
||||
artifactUploadUrls: ArtifactUploadUrls(
|
||||
android: AndroidArtifactUploadUrls(
|
||||
x86: 'x86',
|
||||
aarch64: 'aarch64',
|
||||
arm: 'arm',
|
||||
),
|
||||
),
|
||||
);
|
||||
const response = CreatePatchResponse(id: 42, number: 1);
|
||||
expect(
|
||||
CreatePatchResponse.fromJson(response.toJson()).toJson(),
|
||||
equals(response.toJson()),
|
||||
|
||||
+3
-3
@@ -2,16 +2,16 @@ import 'package:shorebird_code_push_protocol/shorebird_code_push_protocol.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
void main() {
|
||||
group(CreateArtifactRequest, () {
|
||||
group(CreatePatchArtifactRequest, () {
|
||||
test('can be (de)serialized', () {
|
||||
const request = CreateArtifactRequest(
|
||||
const request = CreatePatchArtifactRequest(
|
||||
arch: 'arm64',
|
||||
platform: 'android',
|
||||
hash: '1234',
|
||||
size: 9876,
|
||||
);
|
||||
expect(
|
||||
CreateArtifactRequest.fromJson(request.toJson()).toJson(),
|
||||
CreatePatchArtifactRequest.fromJson(request.toJson()).toJson(),
|
||||
equals(request.toJson()),
|
||||
);
|
||||
});
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
import 'package:shorebird_code_push_protocol/shorebird_code_push_protocol.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
void main() {
|
||||
group(CreatePatchArtifactResponse, () {
|
||||
test('can be (de)serialized', () {
|
||||
const request = CreatePatchArtifactResponse(
|
||||
arch: 'arm64',
|
||||
platform: 'android',
|
||||
hash: '1234',
|
||||
size: 9876,
|
||||
url: 'https://example.com',
|
||||
);
|
||||
expect(
|
||||
CreatePatchArtifactResponse.fromJson(request.toJson()).toJson(),
|
||||
equals(request.toJson()),
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
-7
@@ -10,13 +10,6 @@ void main() {
|
||||
version: '1.0.0',
|
||||
displayName: 'v1.0.0',
|
||||
flutterRevision: 'flutter-revision',
|
||||
artifactUploadUrls: ArtifactUploadUrls(
|
||||
android: AndroidArtifactUploadUrls(
|
||||
x86: 'x86',
|
||||
aarch64: 'aarch64',
|
||||
arm: 'arm',
|
||||
),
|
||||
),
|
||||
);
|
||||
expect(
|
||||
CreateReleaseResponse.fromJson(response.toJson()).toJson(),
|
||||
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
import 'package:shorebird_code_push_protocol/shorebird_code_push_protocol.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
void main() {
|
||||
group(CreateReleaseArtifactResponse, () {
|
||||
test('can be (de)serialized', () {
|
||||
const response = CreateReleaseArtifactResponse(
|
||||
arch: 'arm64',
|
||||
platform: 'android',
|
||||
hash: '1234',
|
||||
size: 9876,
|
||||
url: 'https://example.com',
|
||||
);
|
||||
expect(
|
||||
CreateReleaseArtifactResponse.fromJson(response.toJson()).toJson(),
|
||||
equals(response.toJson()),
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
import 'package:shorebird_code_push_protocol/shorebird_code_push_protocol.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
void main() {
|
||||
group(ArtifactUploadUrls, () {
|
||||
test('can be (de)serialized', () {
|
||||
const artifactUploadUrls = ArtifactUploadUrls(
|
||||
android: AndroidArtifactUploadUrls(
|
||||
x86: 'x86',
|
||||
aarch64: 'aarch64',
|
||||
arm: 'arm',
|
||||
),
|
||||
);
|
||||
expect(
|
||||
ArtifactUploadUrls.fromJson(artifactUploadUrls.toJson()).toJson(),
|
||||
equals(artifactUploadUrls.toJson()),
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user