test: add tests for stream chat flutter (#335)

* feat: Added tests

* feat: Added header test

* feat: Added new tests

* fix

* feat: Added test, fmt

* feat: Added delete test

* added system and unread ind tests

* fix: analysis

* added new tests

* fix: analysis

* added tests

* add attachment actions modal tests

* fix analysis

* fix analysis

* add backbutton tests

* fix analysis

* increase timeout

* add channelheader tests

* add infotile tests

* add reactions modal and channel unread indicator tests

* add golden test for reaction bubble

* add dark tests

* add system message golden

* add deletd message golden

* add message action modal tests

* update goldens

* update workflow runner

* update goldens

* remove channel unread indicator in favor of unread indicator

* move file and media screen to sample app

* add channel image tesst

* add channel_list_header test

* add thread_header test

* bump up test threashold

* fix review

Co-authored-by: Salvatore Giordano <[email protected]>
This commit is contained in:
Deven Joshi
2021-04-08 17:43:08 +02:00
committed by GitHub
co-authored by Salvatore Giordano
parent 4946664220
commit a42b3de6f4
58 changed files with 4140 additions and 968 deletions
@@ -1,5 +1,6 @@
// ignore_for_file: public_member_api_docs
import 'package:equatable/equatable.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:stream_chat/src/models/action.dart';
import 'package:stream_chat/src/models/attachment_file.dart';
@@ -10,7 +11,7 @@ part 'attachment.g.dart';
/// The class that contains the information about an attachment
@JsonSerializable(includeIfNull: false)
class Attachment {
class Attachment extends Equatable {
/// Constructor used for json serialization
Attachment({
String id,
@@ -37,12 +38,11 @@ class Attachment {
UploadState uploadState,
}) : id = id ?? Uuid().v4(),
title = title ?? file?.name,
localUri = file?.path != null ? Uri.parse(file.path) : null {
this.uploadState = uploadState ??
((assetUrl != null || imageUrl != null)
? const UploadState.success()
: const UploadState.preparing());
}
localUri = file?.path != null ? Uri.parse(file.path) : null,
uploadState = uploadState ??
((assetUrl != null || imageUrl != null)
? const UploadState.success()
: const UploadState.preparing());
/// Create a new instance from a json
factory Attachment.fromJson(Map<String, dynamic> json) =>
@@ -104,7 +104,7 @@ class Attachment {
final AttachmentFile file;
/// The current upload state of the attachment
UploadState uploadState;
final UploadState uploadState;
/// Map of custom channel extraData
@JsonKey(includeIfNull: false)
@@ -205,49 +205,28 @@ class Attachment {
);
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is Attachment &&
runtimeType == other.runtimeType &&
type == other.type &&
titleLink == other.titleLink &&
title == other.title &&
thumbUrl == other.thumbUrl &&
text == other.text &&
pretext == other.pretext &&
ogScrapeUrl == other.ogScrapeUrl &&
imageUrl == other.imageUrl &&
footerIcon == other.footerIcon &&
footer == other.footer &&
fields == other.fields &&
fallback == other.fallback &&
color == other.color &&
authorName == other.authorName &&
authorLink == other.authorLink &&
authorIcon == other.authorIcon &&
assetUrl == other.assetUrl &&
actions == other.actions &&
extraData == other.extraData;
@override
int get hashCode =>
type.hashCode ^
titleLink.hashCode ^
title.hashCode ^
thumbUrl.hashCode ^
text.hashCode ^
pretext.hashCode ^
ogScrapeUrl.hashCode ^
imageUrl.hashCode ^
footerIcon.hashCode ^
footer.hashCode ^
fields.hashCode ^
fallback.hashCode ^
color.hashCode ^
authorName.hashCode ^
authorLink.hashCode ^
authorIcon.hashCode ^
assetUrl.hashCode ^
actions.hashCode ^
extraData.hashCode;
List<Object> get props => [
id,
type,
titleLink,
title,
thumbUrl,
text,
pretext,
ogScrapeUrl,
imageUrl,
footerIcon,
footer,
fields,
fallback,
color,
authorName,
authorLink,
authorIcon,
assetUrl,
actions,
file,
uploadState,
extraData,
];
}
@@ -1,3 +1,4 @@
import 'package:equatable/equatable.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:stream_chat/src/models/attachment.dart';
import 'package:stream_chat/src/models/reaction.dart';
@@ -41,7 +42,7 @@ enum MessageSendingStatus {
/// The class that contains the information about a message
@JsonSerializable()
class Message {
class Message extends Equatable {
/// Constructor used for json serialization
Message({
String id,
@@ -345,6 +346,39 @@ class Message {
pinnedBy: other.pinnedBy,
);
}
@override
List<Object> get props => [
id,
text,
type,
attachments,
mentionedUsers,
reactionCounts,
reactionScores,
latestReactions,
ownReactions,
parentId,
quotedMessage,
quotedMessageId,
replyCount,
threadParticipants,
showInChannel,
shadowed,
silent,
command,
createdAt,
updatedAt,
deletedAt,
user,
pinned,
pinnedAt,
pinExpires,
pinnedBy,
extraData,
status,
skipPush,
];
}
/// A translated message
@@ -15,6 +15,7 @@ export './src/attachment_file_uploader.dart' show AttachmentFileUploader;
export './src/client.dart';
export './src/db/chat_persistence_client.dart';
export './src/event_type.dart';
export './src/exceptions.dart';
export './src/extensions/rate_limit.dart';
export './src/extensions/string_extension.dart';
export './src/models/action.dart';
+1
View File
@@ -12,6 +12,7 @@ dependencies:
async: ^2.4.2
collection: ^1.14.13
dio: ^3.0.10
equatable: ^2.0.0
freezed_annotation: ^0.12.0
http_parser: ^3.1.4
json_annotation: ^3.0.1