move jsons to fixtures

This commit is contained in:
Salvatore Giordano
2021-06-17 09:31:53 +02:00
parent 00642a5439
commit 2d6cc796e8
32 changed files with 1530 additions and 1559 deletions
@@ -1,2 +1,2 @@
export 'chat_error_code.dart';
export 'stream_chat_error.dart';
export 'stream_chat_error.dart';
@@ -78,8 +78,7 @@ class ChannelModel {
final DateTime? deletedAt;
/// The count of this channel members
@JsonKey(
includeIfNull: false, toJson: Serializer.readOnly, defaultValue: 0)
@JsonKey(includeIfNull: false, toJson: Serializer.readOnly, defaultValue: 0)
final int memberCount;
/// Map of custom channel extraData
@@ -61,21 +61,16 @@ class OwnUser extends User {
/// List of users muted by the user
@JsonKey(
includeIfNull: false,
toJson: Serializer.readOnly,
defaultValue: <Mute>[])
includeIfNull: false, toJson: Serializer.readOnly, defaultValue: <Mute>[])
final List<Mute> mutes;
/// List of users muted by the user
@JsonKey(
includeIfNull: false,
toJson: Serializer.readOnly,
defaultValue: <Mute>[])
includeIfNull: false, toJson: Serializer.readOnly, defaultValue: <Mute>[])
final List<Mute> channelMutes;
/// Total unread messages by the user
@JsonKey(
includeIfNull: false, toJson: Serializer.readOnly, defaultValue: 0)
@JsonKey(includeIfNull: false, toJson: Serializer.readOnly, defaultValue: 0)
final int totalUnreadCount;
/// Total unread channels by the user
@@ -22,8 +22,8 @@ class User extends Equatable {
updatedAt = updatedAt ?? DateTime.now();
/// Create a new instance from a json
factory User.fromJson(Map<String, dynamic> json) => _$UserFromJson(
Serializer.moveToExtraDataFromRoot(json, topLevelFields));
factory User.fromJson(Map<String, dynamic> json) =>
_$UserFromJson(Serializer.moveToExtraDataFromRoot(json, topLevelFields));
/// Known top level fields.
/// Useful for [Serializer] methods.
+7
View File
@@ -0,0 +1,7 @@
{
"name": "name",
"style": "style",
"text": "text",
"type": "type",
"value": "value"
}
+29
View File
@@ -0,0 +1,29 @@
{
"type": "giphy",
"title": "awesome",
"title_link": "https://giphy.com/gifs/nrkp3-dance-happy-3o7TKnCdBx5cMg0qti",
"thumb_url": "https://media0.giphy.com/media/3o7TKnCdBx5cMg0qti/giphy.gif",
"actions": [
{
"name": "image_action",
"text": "Send",
"style": "primary",
"type": "button",
"value": "send"
},
{
"name": "image_action",
"text": "Shuffle",
"style": "default",
"type": "button",
"value": "shuffle"
},
{
"name": "image_action",
"text": "Cancel",
"style": "default",
"type": "button",
"value": "cancel"
}
]
}
+7
View File
@@ -0,0 +1,7 @@
{
"id": "test",
"type": "livestream",
"cid": "livestream:test",
"cats": true,
"fruit": ["bananas", "apples"]
}
+832
View File
@@ -0,0 +1,832 @@
{
"channel": {
"id": "dev",
"type": "team",
"cid": "team:dev",
"last_message_at": "2020-01-30T13:43:41.062362Z",
"created_at": "2019-04-03T18:43:33.213373Z",
"updated_at": "2019-04-03T18:43:33.213374Z",
"team": "test",
"created_by": {
"id": "guido",
"role": "user",
"created_at": "2019-04-03T18:43:33.201036Z",
"updated_at": "2019-04-03T18:43:33.204713Z",
"banned": false,
"online": false,
"name": "Guido"
},
"frozen": true,
"config": {
"created_at": "2019-11-07T22:29:26.776526Z",
"updated_at": "2019-11-07T22:29:48.286746Z",
"name": "team",
"typing_events": true,
"read_events": true,
"connect_events": true,
"search": true,
"reactions": true,
"replies": true,
"mutes": true,
"uploads": true,
"url_enrichment": true,
"message_retention": "infinite",
"max_message_length": 5000,
"automod": "disabled",
"automod_behavior": "flag",
"commands": [
{
"name": "giphy",
"description": "Post a random gif to the channel",
"args": "[text]",
"set": "fun_set"
}
]
},
"name": "#dev",
"image": "https://cdn.chrisshort.net/testing-certificate-chains-in-go/GOPHER_MIC_DROP.png",
"example": 1
},
"messages": [
{
"id": "dry-meadow-0-2b73cc8b-cd86-4a01-8d40-bd82ad07a030",
"text": "fasdfa",
"type": "regular",
"status": "SENT",
"silent": false,
"user": {
"id": "dry-meadow-0",
"role": "user",
"created_at": "2019-03-27T17:40:17.155892Z",
"updated_at": "2020-01-29T03:22:47.641589Z",
"last_active": "2020-01-29T03:22:47.63613Z",
"banned": false,
"online": false,
"image": "https://getstream.io/random_svg/?name=Dry+meadow",
"name": "Dry meadow"
},
"attachments": [],
"latest_reactions": [],
"own_reactions": [],
"reaction_counts": {},
"reaction_scores": {},
"reply_count": 0,
"created_at": "2020-01-29T03:23:02.843948Z",
"updated_at": "2020-01-29T03:23:02.843949Z",
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "dry-meadow-0-e8e74482-b4cd-48db-9d1e-30e6c191786f",
"text": "test message",
"type": "regular",
"user": {
"id": "dry-meadow-0",
"role": "user",
"created_at": "2019-03-27T17:40:17.155892Z",
"updated_at": "2020-01-29T03:22:47.641589Z",
"last_active": "2020-01-29T03:22:47.63613Z",
"banned": false,
"online": false,
"image": "https://getstream.io/random_svg/?name=Dry+meadow",
"name": "Dry meadow"
},
"attachments": [],
"latest_reactions": [],
"own_reactions": [],
"reaction_counts": {},
"reaction_scores": {},
"reply_count": 0,
"created_at": "2020-01-29T03:23:07.981091Z",
"updated_at": "2020-01-29T03:23:07.981091Z",
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "dry-meadow-0-53e6299f-9b97-4a9c-a27e-7e2dde49b7e0",
"text": "test message",
"type": "regular",
"user": {
"id": "dry-meadow-0",
"role": "user",
"created_at": "2019-03-27T17:40:17.155892Z",
"updated_at": "2020-01-29T03:22:47.641589Z",
"last_active": "2020-01-29T03:22:47.63613Z",
"banned": false,
"online": false,
"image": "https://getstream.io/random_svg/?name=Dry+meadow",
"name": "Dry meadow"
},
"attachments": [],
"latest_reactions": [],
"own_reactions": [],
"reaction_counts": {},
"reaction_scores": {},
"reply_count": 0,
"created_at": "2020-01-29T03:23:11.568022Z",
"updated_at": "2020-01-29T03:23:11.568022Z",
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "dry-meadow-0-80925be0-786e-40a5-b225-486518dafd35",
"text": "asdfadf",
"type": "regular",
"user": {
"id": "dry-meadow-0",
"role": "user",
"created_at": "2019-03-27T17:40:17.155892Z",
"updated_at": "2020-01-29T03:22:47.641589Z",
"last_active": "2020-01-29T03:22:47.63613Z",
"banned": false,
"online": false,
"image": "https://getstream.io/random_svg/?name=Dry+meadow",
"name": "Dry meadow"
},
"attachments": [],
"latest_reactions": [],
"own_reactions": [],
"reaction_counts": {},
"reaction_scores": {},
"reply_count": 0,
"created_at": "2020-01-29T03:32:57.403566Z",
"updated_at": "2020-01-29T03:32:57.403566Z",
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "dry-meadow-0-64d7970f-ede8-4b31-9738-1bc1756d2bfe",
"text": "test",
"type": "regular",
"user": {
"id": "dry-meadow-0",
"role": "user",
"created_at": "2019-03-27T17:40:17.155892Z",
"updated_at": "2020-01-29T03:22:47.641589Z",
"last_active": "2020-01-29T03:22:47.63613Z",
"banned": false,
"online": false,
"image": "https://getstream.io/random_svg/?name=Dry+meadow",
"name": "Dry meadow"
},
"attachments": [],
"latest_reactions": [],
"own_reactions": [],
"reaction_counts": {},
"reaction_scores": {},
"reply_count": 0,
"created_at": "2020-01-29T03:33:35.294802Z",
"updated_at": "2020-01-29T03:33:35.294802Z",
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "withered-cell-0-84cbd760-cf55-4f7e-9207-c5f66cccc6dc",
"text": "hi",
"type": "regular",
"user": {
"id": "withered-cell-0",
"role": "user",
"created_at": "2020-01-29T03:34:01.698106Z",
"updated_at": "2020-01-29T03:34:01.708808Z",
"last_active": "2020-01-29T03:34:01.70353Z",
"banned": false,
"online": false,
"name": "Withered cell",
"image": "https://getstream.io/random_svg/?name=Withered+cell"
},
"attachments": [],
"latest_reactions": [],
"own_reactions": [],
"reaction_counts": {},
"reaction_scores": {},
"reply_count": 0,
"created_at": "2020-01-29T03:34:27.393296Z",
"updated_at": "2020-01-29T03:34:27.393296Z",
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "dry-meadow-0-e9203588-43c3-40b1-91f7-f217fc42aa53",
"text": "fantastic",
"type": "regular",
"user": {
"id": "dry-meadow-0",
"role": "user",
"created_at": "2019-03-27T17:40:17.155892Z",
"updated_at": "2020-01-29T03:22:47.641589Z",
"last_active": "2020-01-29T03:22:47.63613Z",
"banned": false,
"online": false,
"image": "https://getstream.io/random_svg/?name=Dry+meadow",
"name": "Dry meadow"
},
"attachments": [],
"latest_reactions": [],
"own_reactions": [],
"reaction_counts": {},
"reaction_scores": {},
"reply_count": 0,
"created_at": "2020-01-29T03:34:37.638376Z",
"updated_at": "2020-01-29T03:34:37.638376Z",
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "withered-cell-0-7e3552d7-7a0d-45f2-a856-e91b23a7e240",
"text": "nice to meet you",
"type": "regular",
"user": {
"id": "withered-cell-0",
"role": "user",
"created_at": "2020-01-29T03:34:01.698106Z",
"updated_at": "2020-01-29T03:34:01.708808Z",
"last_active": "2020-01-29T03:34:01.70353Z",
"banned": false,
"online": false,
"image": "https://getstream.io/random_svg/?name=Withered+cell",
"name": "Withered cell"
},
"attachments": [],
"latest_reactions": [],
"own_reactions": [],
"reaction_counts": {},
"reaction_scores": {},
"reply_count": 0,
"created_at": "2020-01-29T03:35:04.301566Z",
"updated_at": "2020-01-29T03:35:04.301566Z",
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "dry-meadow-0-1ffeafd4-e4fc-4c84-9394-9d7cb10fff42",
"text": "hey",
"type": "regular",
"user": {
"id": "dry-meadow-0",
"role": "user",
"created_at": "2019-03-27T17:40:17.155892Z",
"updated_at": "2020-01-29T03:22:47.641589Z",
"last_active": "2020-01-29T03:22:47.63613Z",
"banned": false,
"online": false,
"image": "https://getstream.io/random_svg/?name=Dry+meadow",
"name": "Dry meadow"
},
"attachments": [],
"latest_reactions": [],
"own_reactions": [],
"reaction_counts": {},
"reaction_scores": {},
"reply_count": 0,
"created_at": "2020-01-29T03:35:24.939084Z",
"updated_at": "2020-01-29T03:35:24.939085Z",
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "dry-meadow-0-3f147324-12c8-4b41-9fb5-2db88d065efa",
"text": "hello, everyone",
"type": "regular",
"user": {
"id": "dry-meadow-0",
"role": "user",
"created_at": "2019-03-27T17:40:17.155892Z",
"updated_at": "2020-01-29T03:22:47.641589Z",
"last_active": "2020-01-29T03:22:47.63613Z",
"banned": false,
"online": false,
"name": "Dry meadow",
"image": "https://getstream.io/random_svg/?name=Dry+meadow"
},
"attachments": [],
"latest_reactions": [],
"own_reactions": [],
"reaction_counts": {},
"reaction_scores": {},
"reply_count": 0,
"created_at": "2020-01-29T03:35:33.101566Z",
"updated_at": "2020-01-29T03:35:33.101566Z",
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "dry-meadow-0-51a348ae-0c0a-44de-a556-eac7891c0cf0",
"text": "who is there?",
"type": "regular",
"user": {
"id": "dry-meadow-0",
"role": "user",
"created_at": "2019-03-27T17:40:17.155892Z",
"updated_at": "2020-01-29T03:22:47.641589Z",
"last_active": "2020-01-29T03:22:47.63613Z",
"banned": false,
"online": false,
"name": "Dry meadow",
"image": "https://getstream.io/random_svg/?name=Dry+meadow"
},
"attachments": [],
"latest_reactions": [],
"own_reactions": [],
"reaction_counts": {},
"reaction_scores": {},
"reply_count": 0,
"created_at": "2020-01-29T03:35:45.458685Z",
"updated_at": "2020-01-29T03:35:45.458685Z",
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "icy-recipe-7-a29e237b-8d81-4a97-9bc8-d42bca3f1356",
"text": "하이",
"type": "regular",
"user": {
"id": "icy-recipe-7",
"role": "user",
"created_at": "2020-01-21T11:36:22.284503Z",
"updated_at": "2020-01-29T07:01:59.69882Z",
"last_active": "2020-01-29T07:01:59.693378Z",
"banned": false,
"online": false,
"image": "https://getstream.io/random_svg/?name=Icy+recipe",
"name": "Icy recipe"
},
"attachments": [],
"latest_reactions": [],
"own_reactions": [],
"reaction_counts": {},
"reaction_scores": {},
"reply_count": 0,
"created_at": "2020-01-29T07:02:11.535395Z",
"updated_at": "2020-01-29T07:02:11.535395Z",
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "icy-recipe-7-935c396e-ddf8-4a9a-951c-0a12fa5bf055",
"text": "what are you doing?",
"type": "regular",
"user": {
"id": "icy-recipe-7",
"role": "user",
"created_at": "2020-01-21T11:36:22.284503Z",
"updated_at": "2020-01-29T07:01:59.69882Z",
"last_active": "2020-01-29T07:01:59.693378Z",
"banned": false,
"online": false,
"image": "https://getstream.io/random_svg/?name=Icy+recipe",
"name": "Icy recipe"
},
"attachments": [],
"latest_reactions": [],
"own_reactions": [],
"reaction_counts": {},
"reaction_scores": {},
"reply_count": 0,
"created_at": "2020-01-29T07:02:22.485136Z",
"updated_at": "2020-01-29T07:02:22.485136Z",
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "throbbing-boat-5-1e4d5730-5ff0-4d25-9948-9f34ffda43e4",
"text": "👍",
"type": "regular",
"user": {
"id": "throbbing-boat-5",
"role": "user",
"created_at": "2019-07-30T06:29:53.060413Z",
"updated_at": "2020-01-29T14:11:27.80176Z",
"last_active": "2020-01-29T14:11:27.7963Z",
"banned": false,
"online": false,
"image": "https://getstream.io/random_svg/?name=Throbbing+boat",
"name": "Throbbing boat"
},
"attachments": [],
"latest_reactions": [],
"own_reactions": [],
"reaction_counts": {},
"reaction_scores": {},
"reply_count": 0,
"created_at": "2020-01-29T14:12:04.688552Z",
"updated_at": "2020-01-29T14:12:04.688552Z",
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "snowy-credit-3-3e0c1a0d-d22f-42ee-b2a1-f9f49477bf21",
"text": "sdasas",
"type": "regular",
"user": {
"id": "snowy-credit-3",
"role": "user",
"created_at": "2020-01-29T15:29:03.693312Z",
"updated_at": "2020-01-29T15:29:03.702648Z",
"last_active": "2020-01-29T15:29:03.696144Z",
"banned": false,
"online": false,
"image": "https://getstream.io/random_svg/?name=Snowy+credit",
"name": "Snowy credit"
},
"attachments": [],
"latest_reactions": [],
"own_reactions": [],
"reaction_counts": {},
"reaction_scores": {},
"reply_count": 0,
"created_at": "2020-01-29T15:29:36.011315Z",
"updated_at": "2020-01-29T15:29:36.011316Z",
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "snowy-credit-3-3319537e-2d0e-4876-8170-a54f046e4b7d",
"text": "cjshsa",
"type": "regular",
"user": {
"id": "snowy-credit-3",
"role": "user",
"created_at": "2020-01-29T15:29:03.693312Z",
"updated_at": "2020-01-29T15:29:03.702648Z",
"last_active": "2020-01-29T15:29:03.696144Z",
"banned": false,
"online": false,
"image": "https://getstream.io/random_svg/?name=Snowy+credit",
"name": "Snowy credit"
},
"attachments": [],
"latest_reactions": [],
"own_reactions": [],
"reaction_counts": {},
"reaction_scores": {},
"reply_count": 0,
"created_at": "2020-01-29T15:29:41.677819Z",
"updated_at": "2020-01-29T15:29:41.677819Z",
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "snowy-credit-3-cfaf0b46-1daa-49c5-947c-b16d6697487d",
"text": "nhisagdhsadz",
"type": "regular",
"user": {
"id": "snowy-credit-3",
"role": "user",
"created_at": "2020-01-29T15:29:03.693312Z",
"updated_at": "2020-01-29T15:29:03.702648Z",
"last_active": "2020-01-29T15:29:03.696144Z",
"banned": false,
"online": false,
"image": "https://getstream.io/random_svg/?name=Snowy+credit",
"name": "Snowy credit"
},
"attachments": [],
"latest_reactions": [],
"own_reactions": [],
"reaction_counts": {},
"reaction_scores": {},
"reply_count": 0,
"created_at": "2020-01-29T15:29:43.354177Z",
"updated_at": "2020-01-29T15:29:43.354177Z",
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "snowy-credit-3-cebe25a7-a3a3-49fc-9919-91c6725e81f3",
"text": "hvadhsahzd",
"type": "regular",
"user": {
"id": "snowy-credit-3",
"role": "user",
"created_at": "2020-01-29T15:29:03.693312Z",
"updated_at": "2020-01-29T15:29:03.702648Z",
"last_active": "2020-01-29T15:29:03.696144Z",
"banned": false,
"online": false,
"image": "https://getstream.io/random_svg/?name=Snowy+credit",
"name": "Snowy credit"
},
"attachments": [],
"latest_reactions": [],
"own_reactions": [],
"reaction_counts": {},
"reaction_scores": {},
"reply_count": 0,
"created_at": "2020-01-29T15:29:44.754713Z",
"updated_at": "2020-01-29T15:29:44.754713Z",
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "divine-glade-9-0cea9262-5766-48e9-8b22-311870aed3bf",
"text": "hello",
"type": "regular",
"user": {
"id": "divine-glade-9",
"role": "user",
"created_at": "2020-01-29T17:02:18.312524Z",
"updated_at": "2020-01-29T17:02:18.320187Z",
"last_active": "2020-01-29T17:02:18.315074Z",
"banned": false,
"online": false,
"image": "https://getstream.io/random_svg/?name=Divine+glade",
"name": "Divine glade"
},
"attachments": [],
"latest_reactions": [],
"own_reactions": [],
"reaction_counts": {},
"reaction_scores": {},
"reply_count": 0,
"created_at": "2020-01-29T17:02:36.933852Z",
"updated_at": "2020-01-29T17:02:36.933852Z",
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "red-firefly-9-c4e9007b-bb7d-4238-ae08-5f8e3cd03d73",
"text": "hello",
"type": "regular",
"user": {
"id": "red-firefly-9",
"role": "user",
"created_at": "2019-08-02T18:56:39.366516Z",
"updated_at": "2020-01-29T22:13:50.491769Z",
"last_active": "2020-01-29T22:13:50.450215Z",
"banned": false,
"online": false,
"image": "https://getstream.io/random_svg/?name=Red+firefly",
"name": "Red firefly"
},
"attachments": [],
"latest_reactions": [],
"own_reactions": [],
"reaction_counts": {},
"reaction_scores": {},
"reply_count": 0,
"created_at": "2020-01-29T22:14:08.54062Z",
"updated_at": "2020-01-29T22:14:08.54062Z",
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "bitter-glade-2-02aee4eb-4093-4736-808b-2de75820e854",
"text": "hello",
"type": "regular",
"user": {
"id": "bitter-glade-2",
"role": "user",
"created_at": "2020-01-30T13:08:56.190678Z",
"updated_at": "2020-01-30T13:08:56.200333Z",
"last_active": "2020-01-30T13:08:56.193882Z",
"banned": false,
"online": false,
"image": "https://getstream.io/random_svg/?name=Bitter+glade",
"name": "Bitter glade"
},
"attachments": [],
"latest_reactions": [],
"own_reactions": [],
"reaction_counts": {},
"reaction_scores": {},
"reply_count": 0,
"created_at": "2020-01-30T13:11:37.191293Z",
"updated_at": "2020-01-30T13:11:37.191293Z",
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "morning-sea-1-0c700bcb-46dd-4224-b590-e77bdbccc480",
"text": "http://jaeger.ui.gtstrm.com/",
"type": "regular",
"user": {
"id": "morning-sea-1",
"role": "user",
"created_at": "2019-07-22T09:19:07.505207Z",
"updated_at": "2020-01-30T13:33:05.831856Z",
"last_active": "2020-01-30T13:33:05.825369Z",
"banned": false,
"online": false,
"image": "https://getstream.io/random_svg/?name=Morning+sea",
"name": "Morning sea"
},
"attachments": [],
"latest_reactions": [],
"own_reactions": [],
"reaction_counts": {},
"reaction_scores": {},
"reply_count": 0,
"created_at": "2020-01-30T13:33:16.853116Z",
"updated_at": "2020-01-30T13:33:16.853116Z",
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "ancient-salad-0-53e8b4e6-5b7b-43ad-aeee-8bfb6a9ed0be",
"text": "hi",
"type": "regular",
"user": {
"id": "ancient-salad-0",
"role": "user",
"created_at": "2020-01-30T13:34:29.286813Z",
"updated_at": "2020-01-30T13:34:29.296196Z",
"last_active": "2020-01-30T13:34:29.289964Z",
"banned": false,
"online": true,
"image": "https://getstream.io/random_svg/?name=Ancient+salad",
"name": "Ancient salad"
},
"attachments": [],
"latest_reactions": [],
"own_reactions": [],
"reaction_counts": {},
"reaction_scores": {},
"reply_count": 0,
"created_at": "2020-01-30T13:36:52.749731Z",
"updated_at": "2020-01-30T13:36:52.749732Z",
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "ancient-salad-0-8c225075-bd4c-42e2-8024-530aae13cd40",
"text": "hi",
"type": "regular",
"user": {
"id": "ancient-salad-0",
"role": "user",
"created_at": "2020-01-30T13:34:29.286813Z",
"updated_at": "2020-01-30T13:34:29.296196Z",
"last_active": "2020-01-30T13:34:29.289964Z",
"banned": false,
"online": true,
"image": "https://getstream.io/random_svg/?name=Ancient+salad",
"name": "Ancient salad"
},
"attachments": [],
"latest_reactions": [],
"own_reactions": [],
"reaction_counts": {},
"reaction_scores": {},
"reply_count": 0,
"created_at": "2020-01-30T13:37:41.631056Z",
"updated_at": "2020-01-30T13:37:41.631056Z",
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "proud-sea-7-17802096-cbf8-4e3c-addd-4ee31f4c8b5c",
"text": "😃",
"type": "regular",
"user": {
"id": "proud-sea-7",
"role": "user",
"created_at": "2020-01-30T13:43:03.903006Z",
"updated_at": "2020-01-30T13:43:03.912307Z",
"last_active": "2020-01-30T13:43:03.906236Z",
"banned": false,
"online": false,
"image": "https://getstream.io/random_svg/?name=Proud+sea",
"name": "Proud sea"
},
"attachments": [],
"latest_reactions": [],
"own_reactions": [],
"reaction_counts": {},
"reaction_scores": {},
"reply_count": 0,
"created_at": "2020-01-30T13:43:41.062362Z",
"updated_at": "2020-01-30T13:43:41.062362Z",
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
}
],
"watcher_count": 5,
"members": []
}
@@ -0,0 +1,418 @@
{
"channel": {
"id": "dev",
"type": "team",
"frozen": true,
"name": "#dev",
"image": "https://cdn.chrisshort.net/testing-certificate-chains-in-go/GOPHER_MIC_DROP.png",
"example": 1
},
"watchers": [],
"read": [],
"messages": [
{
"id": "dry-meadow-0-2b73cc8b-cd86-4a01-8d40-bd82ad07a030",
"text": "fasdfa",
"attachments": [],
"parent_id": null,
"quoted_message": null,
"quoted_message_id": null,
"show_in_channel": null,
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "dry-meadow-0-e8e74482-b4cd-48db-9d1e-30e6c191786f",
"text": "test message",
"attachments": [],
"parent_id": null,
"quoted_message": null,
"quoted_message_id": null,
"show_in_channel": null,
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "dry-meadow-0-53e6299f-9b97-4a9c-a27e-7e2dde49b7e0",
"text": "test message",
"attachments": [],
"parent_id": null,
"quoted_message": null,
"quoted_message_id": null,
"show_in_channel": null,
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "dry-meadow-0-80925be0-786e-40a5-b225-486518dafd35",
"text": "asdfadf",
"attachments": [],
"parent_id": null,
"quoted_message": null,
"quoted_message_id": null,
"show_in_channel": null,
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "dry-meadow-0-64d7970f-ede8-4b31-9738-1bc1756d2bfe",
"text": "test",
"attachments": [],
"parent_id": null,
"quoted_message": null,
"quoted_message_id": null,
"show_in_channel": null,
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "withered-cell-0-84cbd760-cf55-4f7e-9207-c5f66cccc6dc",
"text": "hi",
"attachments": [],
"parent_id": null,
"quoted_message": null,
"quoted_message_id": null,
"show_in_channel": null,
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "dry-meadow-0-e9203588-43c3-40b1-91f7-f217fc42aa53",
"text": "fantastic",
"attachments": [],
"parent_id": null,
"quoted_message": null,
"quoted_message_id": null,
"show_in_channel": null,
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "withered-cell-0-7e3552d7-7a0d-45f2-a856-e91b23a7e240",
"text": "nice to meet you",
"attachments": [],
"parent_id": null,
"quoted_message": null,
"quoted_message_id": null,
"show_in_channel": null,
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "dry-meadow-0-1ffeafd4-e4fc-4c84-9394-9d7cb10fff42",
"text": "hey",
"attachments": [],
"parent_id": null,
"quoted_message": null,
"quoted_message_id": null,
"show_in_channel": null,
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "dry-meadow-0-3f147324-12c8-4b41-9fb5-2db88d065efa",
"text": "hello, everyone",
"attachments": [],
"parent_id": null,
"quoted_message": null,
"quoted_message_id": null,
"show_in_channel": null,
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "dry-meadow-0-51a348ae-0c0a-44de-a556-eac7891c0cf0",
"text": "who is there?",
"attachments": [],
"parent_id": null,
"quoted_message": null,
"quoted_message_id": null,
"show_in_channel": null,
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "icy-recipe-7-a29e237b-8d81-4a97-9bc8-d42bca3f1356",
"text": "하이",
"attachments": [],
"parent_id": null,
"quoted_message": null,
"quoted_message_id": null,
"show_in_channel": null,
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "icy-recipe-7-935c396e-ddf8-4a9a-951c-0a12fa5bf055",
"text": "what are you doing?",
"attachments": [],
"parent_id": null,
"quoted_message": null,
"quoted_message_id": null,
"show_in_channel": null,
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "throbbing-boat-5-1e4d5730-5ff0-4d25-9948-9f34ffda43e4",
"text": "👍",
"attachments": [],
"parent_id": null,
"quoted_message": null,
"quoted_message_id": null,
"show_in_channel": null,
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "snowy-credit-3-3e0c1a0d-d22f-42ee-b2a1-f9f49477bf21",
"text": "sdasas",
"attachments": [],
"parent_id": null,
"quoted_message": null,
"quoted_message_id": null,
"show_in_channel": null,
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "snowy-credit-3-3319537e-2d0e-4876-8170-a54f046e4b7d",
"text": "cjshsa",
"attachments": [],
"parent_id": null,
"quoted_message": null,
"quoted_message_id": null,
"show_in_channel": null,
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "snowy-credit-3-cfaf0b46-1daa-49c5-947c-b16d6697487d",
"text": "nhisagdhsadz",
"attachments": [],
"parent_id": null,
"quoted_message": null,
"quoted_message_id": null,
"show_in_channel": null,
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "snowy-credit-3-cebe25a7-a3a3-49fc-9919-91c6725e81f3",
"text": "hvadhsahzd",
"attachments": [],
"parent_id": null,
"quoted_message": null,
"quoted_message_id": null,
"show_in_channel": null,
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "divine-glade-9-0cea9262-5766-48e9-8b22-311870aed3bf",
"text": "hello",
"attachments": [],
"parent_id": null,
"quoted_message": null,
"quoted_message_id": null,
"show_in_channel": null,
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "red-firefly-9-c4e9007b-bb7d-4238-ae08-5f8e3cd03d73",
"text": "hello",
"attachments": [],
"parent_id": null,
"quoted_message": null,
"quoted_message_id": null,
"show_in_channel": null,
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "bitter-glade-2-02aee4eb-4093-4736-808b-2de75820e854",
"text": "hello",
"attachments": [],
"parent_id": null,
"quoted_message": null,
"quoted_message_id": null,
"show_in_channel": null,
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "morning-sea-1-0c700bcb-46dd-4224-b590-e77bdbccc480",
"text": "http://jaeger.ui.gtstrm.com/",
"attachments": [],
"parent_id": null,
"quoted_message": null,
"quoted_message_id": null,
"show_in_channel": null,
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "ancient-salad-0-53e8b4e6-5b7b-43ad-aeee-8bfb6a9ed0be",
"text": "hi",
"attachments": [],
"parent_id": null,
"quoted_message": null,
"quoted_message_id": null,
"show_in_channel": null,
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "ancient-salad-0-8c225075-bd4c-42e2-8024-530aae13cd40",
"text": "hi",
"attachments": [],
"parent_id": null,
"quoted_message": null,
"quoted_message_id": null,
"show_in_channel": null,
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
},
{
"id": "proud-sea-7-17802096-cbf8-4e3c-addd-4ee31f4c8b5c",
"text": "😃",
"attachments": [],
"parent_id": null,
"quoted_message": null,
"quoted_message_id": null,
"show_in_channel": null,
"mentioned_users": [],
"status": "SENT",
"silent": false,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null
}
],
"pinned_messages": [],
"members": [],
"watcher_count": 5
}
+5
View File
@@ -0,0 +1,5 @@
{
"name": "giphy",
"description": "Post a random gif to the channel",
"args": "[text]"
}
+4
View File
@@ -0,0 +1,4 @@
{
"id": "device-id",
"push_provider": "push-provider"
}
+29
View File
@@ -0,0 +1,29 @@
{
"type": "type",
"cid": "cid",
"connection_id": "connectionId",
"created_at": "2019-04-03T18:43:33.213374Z",
"me": {
"id": "dry-meadow-0",
"role": "user",
"created_at": "2019-03-27T17:40:17.155892Z",
"updated_at": "2020-01-29T03:22:47.641589Z",
"last_active": "2020-01-29T03:22:47.63613Z",
"banned": false,
"online": false,
"image": "https://getstream.io/random_svg/?name=Dry+meadow",
"name": "Dry meadow"
},
"parent_id": null,
"user": {
"id": "dry-meadow-0",
"role": "user",
"created_at": "2019-03-27T17:40:17.155892Z",
"updated_at": "2020-01-29T03:22:47.641589Z",
"last_active": "2020-01-29T03:22:47.63613Z",
"banned": false,
"online": false,
"image": "https://getstream.io/random_svg/?name=Dry+meadow",
"name": "Dry meadow"
}
}
+15
View File
@@ -0,0 +1,15 @@
{
"user": {
"id": "bbb19d9a-ee50-45bc-84e5-0584e79d0c9e",
"role": "user",
"created_at": "2020-01-28T22:17:30.826259Z",
"updated_at": "2020-01-28T22:17:31.101222Z",
"banned": false,
"online": false,
"name": "Robin Papa",
"image": "https://pbs.twimg.com/profile_images/669512187778498560/L7wQctBt.jpg"
},
"role": "member",
"created_at": "2020-01-28T22:17:30.95443Z",
"updated_at": "2020-01-28T22:17:30.95443Z"
}
+65
View File
@@ -0,0 +1,65 @@
{
"id": "4637f7e4-a06b-42db-ba5a-8d8270dd926f",
"text": "https://giphy.com/gifs/the-lion-king-live-action-5zvN79uTGfLMOVfQaA",
"type": "regular",
"silent": false,
"status": "SENT",
"user": {
"id": "c1c9b454-2bcc-402d-8bb0-2f3706ce1680",
"role": "user",
"created_at": "2020-01-28T22:17:30.83015Z",
"updated_at": "2020-01-28T22:17:31.19435Z",
"banned": false,
"online": false,
"image": "https://randomuser.me/api/portraits/women/2.jpg",
"name": "Mia Denys"
},
"attachments": [
{
"type": "video",
"author_name": "GIPHY",
"title": "The Lion King Disney GIF - Find \u0026 Share on GIPHY",
"title_link": "https://media.giphy.com/media/5zvN79uTGfLMOVfQaA/giphy.gif",
"text": "Discover \u0026 share this Lion King Live Action GIF with everyone you know. GIPHY is how you search, share, discover, and create GIFs.",
"image_url": "https://media.giphy.com/media/5zvN79uTGfLMOVfQaA/giphy.gif",
"thumb_url": "https://media.giphy.com/media/5zvN79uTGfLMOVfQaA/giphy.gif",
"asset_url": "https://media.giphy.com/media/5zvN79uTGfLMOVfQaA/giphy.mp4",
"og_scrape_url": "https://giphy.com/gifs/the-lion-king-live-action-5zvN79uTGfLMOVfQaA"
}
],
"latest_reactions": [
{
"message_id": "4637f7e4-a06b-42db-ba5a-8d8270dd926f",
"user_id": "c1c9b454-2bcc-402d-8bb0-2f3706ce1680",
"user": {
"id": "c1c9b454-2bcc-402d-8bb0-2f3706ce1680",
"role": "user",
"created_at": "2020-01-28T22:17:30.83015Z",
"updated_at": "2020-01-28T22:17:31.19435Z",
"banned": false,
"online": false,
"image": "https://randomuser.me/api/portraits/women/2.jpg",
"name": "Mia Denys"
},
"type": "love",
"score": 1,
"created_at": "2020-01-28T22:17:31.128376Z",
"updated_at": "2020-01-28T22:17:31.128376Z"
}
],
"own_reactions": [],
"reaction_counts": {
"love": 1
},
"reaction_scores": {
"love": 1
},
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null,
"reply_count": 0,
"created_at": "2020-01-28T22:17:31.107978Z",
"updated_at": "2020-01-28T22:17:31.130506Z",
"mentioned_users": []
}
+29
View File
@@ -0,0 +1,29 @@
{
"id": "4637f7e4-a06b-42db-ba5a-8d8270dd926f",
"text": "https://giphy.com/gifs/the-lion-king-live-action-5zvN79uTGfLMOVfQaA",
"silent": false,
"attachments": [
{
"type": "video",
"title_link": "https://media.giphy.com/media/5zvN79uTGfLMOVfQaA/giphy.gif",
"title": "The Lion King Disney GIF - Find & Share on GIPHY",
"thumb_url": "https://media.giphy.com/media/5zvN79uTGfLMOVfQaA/giphy.gif",
"text": "Discover & share this Lion King Live Action GIF with everyone you know. GIPHY is how you search, share, discover, and create GIFs.",
"og_scrape_url": "https://giphy.com/gifs/the-lion-king-live-action-5zvN79uTGfLMOVfQaA",
"image_url": "https://media.giphy.com/media/5zvN79uTGfLMOVfQaA/giphy.gif",
"author_name": "GIPHY",
"asset_url": "https://media.giphy.com/media/5zvN79uTGfLMOVfQaA/giphy.mp4",
"actions": []
}
],
"mentioned_users": [],
"parent_id": "parentId",
"quoted_message": null,
"quoted_message_id": null,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null,
"show_in_channel": true,
"hey": "test"
}
+18
View File
@@ -0,0 +1,18 @@
{
"message_id": "76cd8c82-b557-4e48-9d12-87995d3a0e04",
"user_id": "2de0297c-f3f2-489d-b930-ef77342edccf",
"user": {
"id": "2de0297c-f3f2-489d-b930-ef77342edccf",
"role": "user",
"created_at": "2020-01-28T22:17:30.810011Z",
"updated_at": "2020-01-28T22:17:31.077195Z",
"banned": false,
"online": false,
"image": "https://randomuser.me/api/portraits/women/45.jpg",
"name": "Daisy Morgan"
},
"type": "wow",
"score": 1,
"created_at": "2020-01-28T22:17:31.108742Z",
"updated_at": "2020-01-28T22:17:31.108742Z"
}
+7
View File
@@ -0,0 +1,7 @@
{
"user": {
"id": "bbb19d9a-ee50-45bc-84e5-0584e79d0c9e"
},
"last_read": "2020-01-28T22:17:30.966485504Z",
"unread_messages": 10
}
+4
View File
@@ -0,0 +1,4 @@
{
"id": "bbb19d9a-ee50-45bc-84e5-0584e79d0c9e",
"role": "test-role"
}
@@ -1,21 +1,12 @@
import 'dart:convert';
import 'package:test/test.dart';
import 'package:stream_chat/src/core/models/action.dart';
import 'package:test/test.dart';
import '../../utils.dart';
void main() {
group('src/models/action', () {
const jsonExample = '''
{
"name": "name",
"style": "style",
"text": "text",
"type": "type",
"value": "value"
}''';
test('should parse json correctly', () {
final action = Action.fromJson(json.decode(jsonExample));
final action = Action.fromJson(jsonFixture('action.json'));
expect(action.name, 'name');
expect(action.style, 'style');
expect(action.text, 'text');
@@ -1,44 +1,13 @@
import 'dart:convert';
import 'package:stream_chat/src/core/models/action.dart';
import 'package:stream_chat/src/core/models/attachment.dart';
import 'package:test/test.dart';
import '../../utils.dart';
void main() {
group('src/models/attachment', () {
const jsonExample = '''
{
"type": "giphy",
"title": "awesome",
"title_link": "https://giphy.com/gifs/nrkp3-dance-happy-3o7TKnCdBx5cMg0qti",
"thumb_url": "https://media0.giphy.com/media/3o7TKnCdBx5cMg0qti/giphy.gif",
"actions": [
{
"name": "image_action",
"text": "Send",
"style": "primary",
"type": "button",
"value": "send"
},
{
"name": "image_action",
"text": "Shuffle",
"style": "default",
"type": "button",
"value": "shuffle"
},
{
"name": "image_action",
"text": "Cancel",
"style": "default",
"type": "button",
"value": "cancel"
}
]
}''';
test('should parse json correctly', () {
final attachment = Attachment.fromJson(json.decode(jsonExample));
final attachment = Attachment.fromJson(jsonFixture('attachment.json'));
expect(attachment.type, 'giphy');
expect(attachment.title, 'awesome');
expect(
File diff suppressed because it is too large Load Diff
@@ -1,22 +1,12 @@
import 'dart:convert';
import 'package:stream_chat/src/core/models/channel_model.dart';
import 'package:test/test.dart';
import '../../utils.dart';
void main() {
group('src/models/channel', () {
const jsonExample = '''
{
"id": "test",
"type": "livestream",
"cid": "livestream:test",
"cats": true,
"fruit": ["bananas", "apples"]
}
''';
test('should parse json correctly', () {
final channel = ChannelModel.fromJson(json.decode(jsonExample));
final channel = ChannelModel.fromJson(jsonFixture('channel.json'));
expect(channel.id, equals('test'));
expect(channel.type, equals('livestream'));
expect(channel.cid, equals('livestream:test'));
@@ -1,20 +1,12 @@
import 'dart:convert';
import 'package:stream_chat/src/core/models/command.dart';
import 'package:test/test.dart';
import '../../utils.dart';
void main() {
group('src/models/command', () {
const jsonExample = '''
{
"name": "giphy",
"description": "Post a random gif to the channel",
"args": "[text]"
}
''';
test('should parse json correctly', () {
final command = Command.fromJson(json.decode(jsonExample));
final command = Command.fromJson(jsonFixture('command.json'));
expect(command.name, 'giphy');
expect(command.description, 'Post a random gif to the channel');
expect(command.args, '[text]');
@@ -1,18 +1,12 @@
import 'dart:convert';
import 'package:test/test.dart';
import 'package:stream_chat/src/core/models/device.dart';
import 'package:test/test.dart';
import '../../utils.dart';
void main() {
group('src/models/device', () {
const jsonExample = '''
{
"id": "device-id",
"push_provider": "push-provider"
}''';
test('should parse json correctly', () {
final device = Device.fromJson(json.decode(jsonExample));
final device = Device.fromJson(jsonFixture('device.json'));
expect(device.id, 'device-id');
expect(device.pushProvider, 'push-provider');
});
@@ -1,46 +1,14 @@
import 'dart:convert';
import 'package:stream_chat/src/core/models/event.dart';
import 'package:stream_chat/src/core/models/own_user.dart';
import 'package:stream_chat/stream_chat.dart';
import 'package:test/test.dart';
import '../../utils.dart';
void main() {
group('src/models/event', () {
const jsonExample = '''
{
"type": "type",
"cid": "cid",
"connection_id": "connectionId",
"created_at": "2019-04-03T18:43:33.213374Z",
"me": {
"id": "dry-meadow-0",
"role": "user",
"created_at": "2019-03-27T17:40:17.155892Z",
"updated_at": "2020-01-29T03:22:47.641589Z",
"last_active": "2020-01-29T03:22:47.63613Z",
"banned": false,
"online": false,
"image": "https://getstream.io/random_svg/?name=Dry+meadow",
"name": "Dry meadow"
},
"parent_id": null,
"user": {
"id": "dry-meadow-0",
"role": "user",
"created_at": "2019-03-27T17:40:17.155892Z",
"updated_at": "2020-01-29T03:22:47.641589Z",
"last_active": "2020-01-29T03:22:47.63613Z",
"banned": false,
"online": false,
"image": "https://getstream.io/random_svg/?name=Dry+meadow",
"name": "Dry meadow"
}
}
''';
test('should parse json correctly', () {
final event = Event.fromJson(json.decode(jsonExample));
final event = Event.fromJson(jsonFixture('event.json'));
expect(event.type, 'type');
expect(event.cid, 'cid');
expect(event.connectionId, 'connectionId');
@@ -1,31 +1,13 @@
import 'dart:convert';
import 'package:test/test.dart';
import 'package:stream_chat/src/core/models/member.dart';
import 'package:stream_chat/src/core/models/user.dart';
import 'package:test/test.dart';
import '../../utils.dart';
void main() {
group('src/models/member', () {
const jsonExample = '''
{
"user": {
"id": "bbb19d9a-ee50-45bc-84e5-0584e79d0c9e",
"role": "user",
"created_at": "2020-01-28T22:17:30.826259Z",
"updated_at": "2020-01-28T22:17:31.101222Z",
"banned": false,
"online": false,
"name": "Robin Papa",
"image": "https://pbs.twimg.com/profile_images/669512187778498560/L7wQctBt.jpg"
},
"role": "member",
"created_at": "2020-01-28T22:17:30.95443Z",
"updated_at": "2020-01-28T22:17:30.95443Z"
}
''';
test('should parse json correctly', () {
final member = Member.fromJson(json.decode(jsonExample));
final member = Member.fromJson(jsonFixture('member.json'));
expect(member.user, isA<User>());
expect(member.role, 'member');
expect(member.createdAt, DateTime.parse('2020-01-28T22:17:30.95443Z'));
@@ -1,82 +1,15 @@
import 'dart:convert';
import 'package:stream_chat/src/core/models/attachment.dart';
import 'package:stream_chat/src/core/models/message.dart';
import 'package:stream_chat/src/core/models/reaction.dart';
import 'package:stream_chat/src/core/models/user.dart';
import 'package:test/test.dart';
import '../../utils.dart';
void main() {
group('src/models/message', () {
const jsonExample = r'''
{
"id": "4637f7e4-a06b-42db-ba5a-8d8270dd926f",
"text": "https://giphy.com/gifs/the-lion-king-live-action-5zvN79uTGfLMOVfQaA",
"type": "regular",
"silent": false,
"status": "SENT",
"user": {
"id": "c1c9b454-2bcc-402d-8bb0-2f3706ce1680",
"role": "user",
"created_at": "2020-01-28T22:17:30.83015Z",
"updated_at": "2020-01-28T22:17:31.19435Z",
"banned": false,
"online": false,
"image": "https://randomuser.me/api/portraits/women/2.jpg",
"name": "Mia Denys"
},
"attachments": [
{
"type": "video",
"author_name": "GIPHY",
"title": "The Lion King Disney GIF - Find \u0026 Share on GIPHY",
"title_link": "https://media.giphy.com/media/5zvN79uTGfLMOVfQaA/giphy.gif",
"text": "Discover \u0026 share this Lion King Live Action GIF with everyone you know. GIPHY is how you search, share, discover, and create GIFs.",
"image_url": "https://media.giphy.com/media/5zvN79uTGfLMOVfQaA/giphy.gif",
"thumb_url": "https://media.giphy.com/media/5zvN79uTGfLMOVfQaA/giphy.gif",
"asset_url": "https://media.giphy.com/media/5zvN79uTGfLMOVfQaA/giphy.mp4",
"og_scrape_url": "https://giphy.com/gifs/the-lion-king-live-action-5zvN79uTGfLMOVfQaA"
}
],
"latest_reactions": [
{
"message_id": "4637f7e4-a06b-42db-ba5a-8d8270dd926f",
"user_id": "c1c9b454-2bcc-402d-8bb0-2f3706ce1680",
"user": {
"id": "c1c9b454-2bcc-402d-8bb0-2f3706ce1680",
"role": "user",
"created_at": "2020-01-28T22:17:30.83015Z",
"updated_at": "2020-01-28T22:17:31.19435Z",
"banned": false,
"online": false,
"image": "https://randomuser.me/api/portraits/women/2.jpg",
"name": "Mia Denys"
},
"type": "love",
"score": 1,
"created_at": "2020-01-28T22:17:31.128376Z",
"updated_at": "2020-01-28T22:17:31.128376Z"
}
],
"own_reactions": [],
"reaction_counts": {
"love": 1
},
"reaction_scores": {
"love": 1
},
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null,
"reply_count": 0,
"created_at": "2020-01-28T22:17:31.107978Z",
"updated_at": "2020-01-28T22:17:31.130506Z",
"mentioned_users": []
}''';
test('should parse json correctly', () {
final message = Message.fromJson(json.decode(jsonExample));
final message = Message.fromJson(jsonFixture('message.json'));
expect(message.id, '4637f7e4-a06b-42db-ba5a-8d8270dd926f');
expect(message.text,
'https://giphy.com/gifs/the-lion-king-live-action-5zvN79uTGfLMOVfQaA');
@@ -128,37 +61,7 @@ void main() {
expect(
message.toJson(),
json.decode('''
{
"id": "4637f7e4-a06b-42db-ba5a-8d8270dd926f",
"text": "https://giphy.com/gifs/the-lion-king-live-action-5zvN79uTGfLMOVfQaA",
"silent": false,
"attachments": [
{
"type": "video",
"title_link": "https://media.giphy.com/media/5zvN79uTGfLMOVfQaA/giphy.gif",
"title": "The Lion King Disney GIF - Find & Share on GIPHY",
"thumb_url": "https://media.giphy.com/media/5zvN79uTGfLMOVfQaA/giphy.gif",
"text": "Discover & share this Lion King Live Action GIF with everyone you know. GIPHY is how you search, share, discover, and create GIFs.",
"og_scrape_url": "https://giphy.com/gifs/the-lion-king-live-action-5zvN79uTGfLMOVfQaA",
"image_url": "https://media.giphy.com/media/5zvN79uTGfLMOVfQaA/giphy.gif",
"author_name": "GIPHY",
"asset_url": "https://media.giphy.com/media/5zvN79uTGfLMOVfQaA/giphy.mp4",
"actions": []
}
],
"mentioned_users": [],
"parent_id": "parentId",
"quoted_message": null,
"quoted_message_id": null,
"pinned": false,
"pinned_at": null,
"pin_expires": null,
"pinned_by": null,
"show_in_channel": true,
"hey": "test"
}
'''),
jsonFixture('message_to_json.json'),
);
});
});
@@ -1,34 +1,13 @@
import 'dart:convert';
import 'package:stream_chat/src/core/models/reaction.dart';
import 'package:stream_chat/src/core/models/user.dart';
import 'package:test/test.dart';
import '../../utils.dart';
void main() {
group('src/models/reaction', () {
const jsonExample = '''
{
"message_id": "76cd8c82-b557-4e48-9d12-87995d3a0e04",
"user_id": "2de0297c-f3f2-489d-b930-ef77342edccf",
"user": {
"id": "2de0297c-f3f2-489d-b930-ef77342edccf",
"role": "user",
"created_at": "2020-01-28T22:17:30.810011Z",
"updated_at": "2020-01-28T22:17:31.077195Z",
"banned": false,
"online": false,
"image": "https://randomuser.me/api/portraits/women/45.jpg",
"name": "Daisy Morgan"
},
"type": "wow",
"score": 1,
"created_at": "2020-01-28T22:17:31.108742Z",
"updated_at": "2020-01-28T22:17:31.108742Z"
}
''';
test('should parse json correctly', () {
final reaction = Reaction.fromJson(json.decode(jsonExample));
final reaction = Reaction.fromJson(jsonFixture('reaction.json'));
expect(reaction.messageId, '76cd8c82-b557-4e48-9d12-87995d3a0e04');
expect(reaction.createdAt, DateTime.parse('2020-01-28T22:17:31.108742Z'));
expect(reaction.type, 'wow');
@@ -1,23 +1,13 @@
import 'dart:convert';
import 'package:test/test.dart';
import 'package:stream_chat/src/core/models/read.dart';
import 'package:stream_chat/src/core/models/user.dart';
import 'package:test/test.dart';
import '../../utils.dart';
void main() {
group('src/models/read', () {
const jsonExample = '''
{
"user": {
"id": "bbb19d9a-ee50-45bc-84e5-0584e79d0c9e"
},
"last_read": "2020-01-28T22:17:30.966485504Z",
"unread_messages": 10
}
''';
test('should parse json correctly', () {
final read = Read.fromJson(json.decode(jsonExample));
final read = Read.fromJson(jsonFixture('read.json'));
expect(read.lastRead, DateTime.parse('2020-01-28T22:17:30.966485504Z'));
expect(read.user.id, 'bbb19d9a-ee50-45bc-84e5-0584e79d0c9e');
expect(read.unreadMessages, 10);
@@ -1,19 +1,12 @@
import 'dart:convert';
import 'package:stream_chat/src/core/models/user.dart';
import 'package:test/test.dart';
import '../../utils.dart';
void main() {
group('src/models/user', () {
const jsonExample = '''
{
"id": "bbb19d9a-ee50-45bc-84e5-0584e79d0c9e",
"role": "test-role"
}
''';
test('should parse json correctly', () {
final user = User.fromJson(json.decode(jsonExample));
final user = User.fromJson(jsonFixture('user.json'));
expect(user.id, 'bbb19d9a-ee50-45bc-84e5-0584e79d0c9e');
});
+8
View File
@@ -1,10 +1,18 @@
import 'dart:convert';
import 'dart:io';
String fixture(String name) {
final dir = currentDirectory.path;
return File('$dir/test/fixtures/$name').readAsStringSync();
}
File assetFile(String name) {
final dir = currentDirectory.path;
return File('$dir/test/assets/$name');
}
Map<String, dynamic> jsonFixture(String name) => json.decode(fixture(name));
// https://github.com/flutter/flutter/issues/20907
Directory get currentDirectory {
var directory = Directory.current;
@@ -3550,7 +3550,7 @@ class UsersCompanion extends UpdateCompanion<UserEntity> {
this.online = const Value.absent(),
this.banned = const Value.absent(),
required Map<String, Object?> extraData,
}) : id = Value(id),
}) : id = Value(id),
extraData = Value(extraData);
static Insertable<UserEntity> custom({
Expression<String>? id,
@@ -4723,7 +4723,7 @@ class ChannelQueriesCompanion extends UpdateCompanion<ChannelQueryEntity> {
ChannelQueriesCompanion.insert({
required String queryHash,
required String channelCid,
}) : queryHash = Value(queryHash),
}) : queryHash = Value(queryHash),
channelCid = Value(channelCid);
static Insertable<ChannelQueryEntity> custom({
Expression<String>? queryHash,