-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added Construction and Identification tests for video, sticker and do…
…cument messages
- Loading branch information
Showing
28 changed files
with
277 additions
and
24 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
packages/TelegramClient-Core.package/TCCAnimatedStickerMessage.class/methodProperties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/TelegramClient-Core.package/TCCDocumentMessage.class/methodProperties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 8 additions & 8 deletions
16
packages/TelegramClient-Core.package/TCCImageStore.class/methodProperties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
{ | ||
"class" : { | ||
"extractPathFrom:" : " 6/22/2024 13:42:57", | ||
"imageFormFrom:" : " 6/22/2024 13:42:57", | ||
"newWith:" : " 6/22/2024 13:42:57" }, | ||
"extractPathFrom:" : "6/22/2024 13:42:57", | ||
"imageFormFrom:" : "6/22/2024 13:42:57", | ||
"newWith:" : "6/22/2024 13:42:57" }, | ||
"instance" : { | ||
"core" : " 6/22/2024 13:42:57", | ||
"core:" : " 6/22/2024 13:42:57", | ||
"getFormFor:" : " 6/22/2024 13:42:57", | ||
"getFormPromiseFor:" : " 6/22/2024 13:42:57", | ||
"requestImageFor:with:" : " 6/22/2024 13:42:57" } } | ||
"core" : "6/22/2024 13:42:57", | ||
"core:" : "6/22/2024 13:42:57", | ||
"getFormFor:" : "6/22/2024 13:42:57", | ||
"getFormPromiseFor:" : "6/22/2024 13:42:57", | ||
"requestImageFor:with:" : "6/22/2024 13:42:57" } } |
2 changes: 1 addition & 1 deletion
2
packages/TelegramClient-Core.package/TCCStickerMessage.class/methodProperties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 6 additions & 6 deletions
12
packages/TelegramClient-Core.package/TCCStickerStore.class/methodProperties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/TelegramClient-Core.package/TCCVideoMessage.class/methodProperties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
packages/TelegramClient-Core.package/TCCVideoStore.class/methodProperties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
{ | ||
"class" : { | ||
"extractPathFrom:" : " 6/22/2024 13:42:57", | ||
"imageFormFrom:" : " 6/22/2024 13:42:57" }, | ||
"extractPathFrom:" : "6/22/2024 13:42:57", | ||
"imageFormFrom:" : "6/22/2024 13:42:57" }, | ||
"instance" : { | ||
"getFormFor:" : " 6/22/2024 13:42:57", | ||
"getFormPromiseFor:" : " 6/22/2024 13:42:57", | ||
"getFormFor:" : "6/22/2024 13:42:57", | ||
"getFormPromiseFor:" : "6/22/2024 13:42:57", | ||
"getVideoFor:" : "JK 6/12/2024 19:48", | ||
"getVideoPromiseFor:" : "JK 6/12/2024 19:56" } } |
10 changes: 10 additions & 0 deletions
10
...TCTCMessageTests.class/instance/testAnimatedStickerMessageCorrectlyConstructedFromJson.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
testing | ||
testAnimatedStickerMessageCorrectlyConstructedFromJson | ||
|
||
| stickerMessageEvent chat stickerMessage | | ||
|
||
chat := TCTMMocks mockPrivateChat. | ||
stickerMessageEvent := TCTMMocks mockAnimatedStickerMessageJsonFrom: chat id. | ||
stickerMessage := TCCMessage newFromMessageEvent: stickerMessageEvent in: chat with: self core. | ||
|
||
self assert: TCTMMocks mockValidEmoji equals: stickerMessage text. |
10 changes: 10 additions & 0 deletions
10
...kage/TCTCMessageTests.class/instance/testAnimatedStickerMessageTypeIdentifiedCorrectly.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
testing | ||
testAnimatedStickerMessageTypeIdentifiedCorrectly | ||
|
||
| stickerMessageEvent chat stickerMessage | | ||
|
||
chat := TCTMMocks mockPrivateChat. | ||
stickerMessageEvent := TCTMMocks mockAnimatedStickerMessageJsonFrom: chat id. | ||
stickerMessage := TCCMessage newFromMessageEvent: stickerMessageEvent in: chat with: self core. | ||
|
||
self assert: TCCAnimatedStickerMessage equals: stickerMessage class. |
10 changes: 10 additions & 0 deletions
10
...ackage/TCTCMessageTests.class/instance/testDocumentMessageCorrectlyConstructedFromJson.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
testing | ||
testDocumentMessageCorrectlyConstructedFromJson | ||
|
||
| documentMessageEvent chat documentMessage | | ||
|
||
chat := TCTMMocks mockPrivateChat. | ||
documentMessageEvent := TCTMMocks mockDocumentMessageJsonFrom: chat id. | ||
documentMessage := TCCMessage newFromMessageEvent: documentMessageEvent in: chat with: self core. | ||
|
||
self assert: TCTMMocks mockDocumentFileName equals: documentMessage filename. |
10 changes: 10 additions & 0 deletions
10
...ore.package/TCTCMessageTests.class/instance/testDocumentMessageTypeIdentifiedCorrectly.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
testing | ||
testDocumentMessageTypeIdentifiedCorrectly | ||
|
||
| documentMessageEvent chat documentMessage | | ||
|
||
chat := TCTMMocks mockPrivateChat. | ||
documentMessageEvent := TCTMMocks mockDocumentMessageJsonFrom: chat id. | ||
documentMessage := TCCMessage newFromMessageEvent: documentMessageEvent in: chat with: self core. | ||
|
||
self assert: TCCDocumentMessage equals: documentMessage class. |
12 changes: 12 additions & 0 deletions
12
...ge/TCTCMessageTests.class/instance/testStaticStickerMessageCorrectlyContructedFromJson.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
testing | ||
testStaticStickerMessageCorrectlyContructedFromJson | ||
|
||
| stickerMessageEvent chat stickerMessage | | ||
|
||
chat := TCTMMocks mockPrivateChat. | ||
stickerMessageEvent := TCTMMocks mockStaticStickerMessageJsonFrom: chat id. | ||
stickerMessage := TCCMessage newFromMessageEvent: stickerMessageEvent in: chat with: self core. | ||
|
||
self assert: TCTMMocks mockStickerId equals: stickerMessage stickerId. | ||
self assert: TCTMMocks mockStickerWidth equals: stickerMessage width. | ||
self assert: TCTMMocks mockStickerHeight equals: stickerMessage height. |
10 changes: 10 additions & 0 deletions
10
...ackage/TCTCMessageTests.class/instance/testStaticStickerMessageTypeIdentifiedCorrectly.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
testing | ||
testStaticStickerMessageTypeIdentifiedCorrectly | ||
|
||
| stickerMessageEvent chat stickerMessage | | ||
|
||
chat := TCTMMocks mockPrivateChat. | ||
stickerMessageEvent := TCTMMocks mockStaticStickerMessageJsonFrom: chat id. | ||
stickerMessage := TCCMessage newFromMessageEvent: stickerMessageEvent in: chat with: self core. | ||
|
||
self assert: TCCStickerMessage equals: stickerMessage class. |
15 changes: 15 additions & 0 deletions
15
...e.package/TCTCMessageTests.class/instance/testVideoMessageCorrectlyConstructedFromJson.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
testing | ||
testVideoMessageCorrectlyConstructedFromJson | ||
|
||
| videoMessageEvent chat videoMessage | | ||
|
||
chat := TCTMMocks mockPrivateChat. | ||
videoMessageEvent := TCTMMocks mockVideoMessageJsonFrom: chat id. | ||
videoMessage := TCCMessage newFromMessageEvent: videoMessageEvent in: chat with: self core. | ||
|
||
self assert: TCTMMocks mockText equals: videoMessage caption. | ||
self assert: videoMessage hasCaption. | ||
self assert: TCTMMocks mockImageId equals: videoMessage thumbnailId. | ||
self assert: TCTMMocks mockPhotoHeight equals: videoMessage height. | ||
self assert: TCTMMocks mockPhotoWidth equals: videoMessage width. | ||
self assert: TCTMMocks mockVideoId equals: videoMessage videoId. |
10 changes: 10 additions & 0 deletions
10
...s-Core.package/TCTCMessageTests.class/instance/testVideoMessageTypeIdentifiedCorrectly.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
testing | ||
testVideoMessageTypeIdentifiedCorrectly | ||
|
||
| videoMessageEvent chat videoMessage | | ||
|
||
chat := TCTMMocks mockPrivateChat. | ||
videoMessageEvent := TCTMMocks mockVideoMessageJsonFrom: chat id. | ||
videoMessage := TCCMessage newFromMessageEvent: videoMessageEvent in: chat with: self core. | ||
|
||
self assert: TCCVideoMessage equals: videoMessage class. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...gramClientTests-Misc.package/TCTMMocks.class/class/mockAnimatedStickerMessageJsonFrom..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
message - json | ||
mockAnimatedStickerMessageJsonFrom: aChatId | ||
"@linter-ignore" | ||
|
||
^ (JsonObject newFrom: { | ||
'@type' -> 'message'. | ||
'id' -> self mockMessageId. | ||
'chat_id' -> aChatId. | ||
'sender_id' -> (JsonObject newFrom: { | ||
'@type' -> 'messageSenderUser'. | ||
'user_id' -> self mockUser1 id | ||
}). | ||
'content' -> (JsonObject newFrom: { | ||
'@type' -> 'messageSticker'. | ||
'sticker' -> (JsonObject newFrom: { | ||
'is_animated' -> true. | ||
'height' -> self mockStickerHeight. | ||
'width' -> self mockStickerWidth. | ||
'sticker' -> (JsonObject newFrom: { | ||
'id' -> self mockStickerId | ||
}). | ||
'emoji' -> self mockValidEmoji | ||
}). | ||
}). | ||
'is_outgoing' -> false. | ||
'date' -> self mockMessageTimestamp | ||
}) |
4 changes: 4 additions & 0 deletions
4
packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockDocumentFileName.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
message - json | ||
mockDocumentFileName | ||
|
||
^ 'test_document.pdf' |
31 changes: 31 additions & 0 deletions
31
...es/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockDocumentMessageJsonFrom..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
message - json | ||
mockDocumentMessageJsonFrom: aChatId | ||
"@linter-ignore" | ||
|
||
^ (JsonObject newFrom: { | ||
'@type' -> 'message'. | ||
'id' -> self mockMessageId. | ||
'chat_id' -> aChatId. | ||
'sender_id' -> (JsonObject newFrom: { | ||
'@type' -> 'messageSenderUser'. | ||
'user_id' -> self mockUser1 id | ||
}). | ||
'content' -> (JsonObject newFrom: { | ||
'@type' -> 'messageDocument'. | ||
'caption' -> (JsonObject newFrom: { | ||
'text' -> self mockText | ||
}). | ||
'document' -> (JsonObject newFrom: { | ||
'file_name' -> self mockDocumentFileName. | ||
'thumbnail' -> (JsonObject newFrom:{ | ||
'file' -> (JsonObject newFrom: { | ||
'id' -> self mockImageId | ||
}). | ||
'width' -> self mockPhotoWidth. | ||
'height' -> self mockPhotoHeight | ||
}). | ||
}). | ||
}). | ||
'is_outgoing' -> false. | ||
'date' -> self mockMessageTimestamp | ||
}) |
26 changes: 26 additions & 0 deletions
26
...legramClientTests-Misc.package/TCTMMocks.class/class/mockStaticStickerMessageJsonFrom..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
message - json | ||
mockStaticStickerMessageJsonFrom: aChatId | ||
"@linter-ignore" | ||
|
||
^ (JsonObject newFrom: { | ||
'@type' -> 'message'. | ||
'id' -> self mockMessageId. | ||
'chat_id' -> aChatId. | ||
'sender_id' -> (JsonObject newFrom: { | ||
'@type' -> 'messageSenderUser'. | ||
'user_id' -> self mockUser1 id | ||
}). | ||
'content' -> (JsonObject newFrom: { | ||
'@type' -> 'messageSticker'. | ||
'sticker' -> (JsonObject newFrom: { | ||
'is_animated' -> false. | ||
'height' -> self mockStickerHeight. | ||
'width' -> self mockStickerWidth. | ||
'sticker' -> (JsonObject newFrom: { | ||
'id' -> self mockStickerId | ||
}). | ||
}). | ||
}). | ||
'is_outgoing' -> false. | ||
'date' -> self mockMessageTimestamp | ||
}) |
4 changes: 4 additions & 0 deletions
4
packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockStickerHeight.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
image | ||
mockStickerHeight | ||
|
||
^ 100 |
4 changes: 4 additions & 0 deletions
4
packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockStickerId.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
image | ||
mockStickerId | ||
|
||
^ 24 |
4 changes: 4 additions & 0 deletions
4
packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockStickerWidth.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
image | ||
mockStickerWidth | ||
|
||
^ 100 |
4 changes: 4 additions & 0 deletions
4
packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockVideoHeight.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
message | ||
mockVideoHeight | ||
|
||
^ 265 |
4 changes: 4 additions & 0 deletions
4
packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockVideoId.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
image | ||
mockVideoId | ||
|
||
^ 42 |
35 changes: 35 additions & 0 deletions
35
packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockVideoMessageJsonFrom..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
message - json | ||
mockVideoMessageJsonFrom: aChatId | ||
"@linter-ignore" | ||
|
||
^ (JsonObject newFrom: { | ||
'@type' -> 'message'. | ||
'id' -> self mockMessageId. | ||
'chat_id' -> aChatId. | ||
'sender_id' -> (JsonObject newFrom: { | ||
'@type' -> 'messageSenderUser'. | ||
'user_id' -> self mockUser1 id | ||
}). | ||
'content' -> (JsonObject newFrom: { | ||
'@type' -> 'messageVideo'. | ||
'caption' -> (JsonObject newFrom: { | ||
'text' -> self mockText | ||
}). | ||
'video' -> (JsonObject newFrom: { | ||
'height' -> self mockVideoHeight. | ||
'width' -> self mockVideoWidth. | ||
'thumbnail' -> (JsonObject newFrom:{ | ||
'file' -> (JsonObject newFrom: { | ||
'id' -> self mockImageId | ||
}). | ||
'width' -> self mockPhotoWidth. | ||
'height' -> self mockPhotoHeight | ||
}). | ||
'video' -> (JsonObject newFrom:{ | ||
'id' -> self mockVideoId | ||
}). | ||
}). | ||
}). | ||
'is_outgoing' -> false. | ||
'date' -> self mockMessageTimestamp | ||
}) |
4 changes: 4 additions & 0 deletions
4
packages/TelegramClientTests-Misc.package/TCTMMocks.class/class/mockVideoWidth.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
message | ||
mockVideoWidth | ||
|
||
^ 521 |
Oops, something went wrong.