diff --git a/packages/TelegramClient-Core.package/TCCChatsHandler.class/instance/addNewMessage.from..st b/packages/TelegramClient-Core.package/TCCChatsHandler.class/instance/addNewMessage.from..st index 9660594cd..34ecb53ba 100644 --- a/packages/TelegramClient-Core.package/TCCChatsHandler.class/instance/addNewMessage.from..st +++ b/packages/TelegramClient-Core.package/TCCChatsHandler.class/instance/addNewMessage.from..st @@ -1,9 +1,9 @@ events -addNewMessage: aMessageEvent from: aUser +addNewMessage: aMessageJSONObject from: aUser | chat message | - chat := self app chats getChat: (aMessageEvent at: 'chat_id'). - message := TCCMessage newFromMessageEvent: aMessageEvent in: chat from: aUser. + chat := self app chats getChat: (aMessageJSONObject at: 'chat_id'). + message := TCCMessage newFromMessageEvent: aMessageJSONObject in: chat from: aUser. chat addNewestMessage: message. self app triggerEvent: #newMessageReceived with: message. \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCChatsHandler.class/instance/handleNewMessage.from..st b/packages/TelegramClient-Core.package/TCCChatsHandler.class/instance/handleNewMessage.from..st index c36c56b5a..319a01f23 100644 --- a/packages/TelegramClient-Core.package/TCCChatsHandler.class/instance/handleNewMessage.from..st +++ b/packages/TelegramClient-Core.package/TCCChatsHandler.class/instance/handleNewMessage.from..st @@ -1,7 +1,4 @@ event handling -handleNewMessage: anEvent from: aUserEvent +handleNewMessage: aMessageJSONObject from: aUser - | message user | - message := anEvent at: 'message'. - user := TCCUser newFrom: aUserEvent. - self addNewMessage: message from: user. \ No newline at end of file + self addNewMessage: aMessageJSONObject from: aUser diff --git a/packages/TelegramClient-Core.package/TCCChatsHandler.class/methodProperties.json b/packages/TelegramClient-Core.package/TCCChatsHandler.class/methodProperties.json index 9d83dfa0c..f0e7ffe4d 100644 --- a/packages/TelegramClient-Core.package/TCCChatsHandler.class/methodProperties.json +++ b/packages/TelegramClient-Core.package/TCCChatsHandler.class/methodProperties.json @@ -3,7 +3,7 @@ }, "instance" : { "addChat:" : "per 5/15/2021 12:28", - "addNewMessage:from:" : "pk 5/17/2021 19:10", + "addNewMessage:from:" : "pk 5/21/2021 09:23", "app" : "5/11/2021 10:09:15", "app:" : "pk 5/17/2021 19:11", "chatHistoryReceived:" : "pk 5/12/2021 12:35", @@ -11,7 +11,7 @@ "defaultMessageLimit" : "js 8/1/2020 18:24", "getChatHistoryFrom:with:limit:" : "js 8/2/2020 13:17", "getChats" : "js 7/31/2020 22:50", - "handleNewMessage:from:" : "pk 5/17/2021 18:28", + "handleNewMessage:from:" : "pk 5/21/2021 09:23", "openNewChat:" : "pk 5/13/2021 12:45", "remainingMessages" : "5/11/2021 10:09:15", "remainingMessages:" : "js 8/1/2020 16:50", diff --git a/packages/TelegramClient-Core.package/TCCCore.class/instance/handleEvent..st b/packages/TelegramClient-Core.package/TCCCore.class/instance/handleEvent..st index 29606b17e..3dd2a1c6e 100644 --- a/packages/TelegramClient-Core.package/TCCCore.class/instance/handleEvent..st +++ b/packages/TelegramClient-Core.package/TCCCore.class/instance/handleEvent..st @@ -1,4 +1,4 @@ -event handling +events handleEvent: anEvent | update | diff --git a/packages/TelegramClient-Core.package/TCCCore.class/instance/handleMessageEvent..st b/packages/TelegramClient-Core.package/TCCCore.class/instance/handleMessageEvent..st index ea5005be8..0f0fa2def 100644 --- a/packages/TelegramClient-Core.package/TCCCore.class/instance/handleMessageEvent..st +++ b/packages/TelegramClient-Core.package/TCCCore.class/instance/handleMessageEvent..st @@ -1,9 +1,7 @@ events handleMessageEvent: anEvent - |callbackID message| - message := anEvent at: 'message'. - callbackID := (message at: 'id') asString, (message at: 'chat_id'). - self pendingRequests at: callbackID put: [:aUserEvent | - self chatsHandler handleNewMessage: anEvent from: aUserEvent]. - self getUser: ((message at: 'sender') at: 'user_id') with: callbackID \ No newline at end of file + | message userID | + message := anEvent at: 'message'. + userID := (message at: 'sender') at: 'user_id'. + [self chatsHandler handleNewMessage: message from: (self users getUserFor: userID)] fork diff --git a/packages/TelegramClient-Core.package/TCCCore.class/instance/handleUserEvent..st b/packages/TelegramClient-Core.package/TCCCore.class/instance/handleUserEvent..st index f97b930ab..259ef8a38 100644 --- a/packages/TelegramClient-Core.package/TCCCore.class/instance/handleUserEvent..st +++ b/packages/TelegramClient-Core.package/TCCCore.class/instance/handleUserEvent..st @@ -2,6 +2,6 @@ events handleUserEvent: anEvent | extra | - extra := anEvent at: '@extra'. + extra := (anEvent at: '@extra') asString. (self pendingRequests at: extra) value: anEvent. self pendingRequests removeKey: extra ifAbsent: [] \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCCore.class/instance/initialize.st b/packages/TelegramClient-Core.package/TCCCore.class/instance/initialize.st index b303bb444..ba3246928 100644 --- a/packages/TelegramClient-Core.package/TCCCore.class/instance/initialize.st +++ b/packages/TelegramClient-Core.package/TCCCore.class/instance/initialize.st @@ -6,6 +6,7 @@ initialize initializeHandlers; chats: TCCChats newWithDefaultSorting; loggedInUserID: 0; - pendingRequests: Dictionary new. + pendingRequests: Dictionary new; + users: (TCCUsers new core: self). [self receiveLoop] fork. \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCCore.class/instance/registerCallback.with..st b/packages/TelegramClient-Core.package/TCCCore.class/instance/registerCallback.with..st new file mode 100644 index 000000000..1193ab966 --- /dev/null +++ b/packages/TelegramClient-Core.package/TCCCore.class/instance/registerCallback.with..st @@ -0,0 +1,4 @@ +utility +registerCallback: aClosure with: aCallbackId + + self pendingRequests at: (aCallbackId asString) put: aClosure \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCCore.class/instance/getUser.with..st b/packages/TelegramClient-Core.package/TCCCore.class/instance/requestUser.with..st similarity index 75% rename from packages/TelegramClient-Core.package/TCCCore.class/instance/getUser.with..st rename to packages/TelegramClient-Core.package/TCCCore.class/instance/requestUser.with..st index 80b6d48e4..50923fec6 100644 --- a/packages/TelegramClient-Core.package/TCCCore.class/instance/getUser.with..st +++ b/packages/TelegramClient-Core.package/TCCCore.class/instance/requestUser.with..st @@ -1,5 +1,5 @@ events -getUser: aUserId with: aCallbackID +requestUser: aUserId with: aCallbackID self client send: (TCCRequest newWithType: 'getUser' diff --git a/packages/TelegramClient-Core.package/TCCCore.class/instance/users..st b/packages/TelegramClient-Core.package/TCCCore.class/instance/users..st new file mode 100644 index 000000000..694250ea0 --- /dev/null +++ b/packages/TelegramClient-Core.package/TCCCore.class/instance/users..st @@ -0,0 +1,4 @@ +accessing +users: aDictionary + + users := aDictionary \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCCore.class/instance/users.st b/packages/TelegramClient-Core.package/TCCCore.class/instance/users.st new file mode 100644 index 000000000..642c96219 --- /dev/null +++ b/packages/TelegramClient-Core.package/TCCCore.class/instance/users.st @@ -0,0 +1,4 @@ +accessing +users + + ^ users \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCCore.class/methodProperties.json b/packages/TelegramClient-Core.package/TCCCore.class/methodProperties.json index bd5b71608..6717ef587 100644 --- a/packages/TelegramClient-Core.package/TCCCore.class/methodProperties.json +++ b/packages/TelegramClient-Core.package/TCCCore.class/methodProperties.json @@ -14,11 +14,10 @@ "client:" : "js 6/13/2020 19:10", "getChatHistoryFrom:" : "js 8/1/2020 18:19", "getOwnProfile" : "pk 5/13/2021 09:44", - "getUser:with:" : "pk 5/17/2021 19:31", - "handleEvent:" : "pk 5/13/2021 09:53", - "handleMessageEvent:" : "pk 5/19/2021 11:29", - "handleUserEvent:" : "pk 5/17/2021 18:29", - "initialize" : "pk 5/13/2021 09:33", + "handleEvent:" : "RK 5/19/2021 09:57", + "handleMessageEvent:" : "pk 5/30/2021 13:16", + "handleUserEvent:" : "pk 5/21/2021 10:14", + "initialize" : "pk 5/21/2021 09:13", "initializeHandlers" : "js 8/1/2020 18:09", "isClientAlive" : "js 5/28/2020 17:18", "loggedInUserID" : "rs 7/5/2020 14:48", @@ -26,9 +25,13 @@ "pendingRequests" : "pk 5/13/2021 09:46", "pendingRequests:" : "pk 5/13/2021 09:46", "receiveLoop" : "R.S 6/1/2020 15:24", + "registerCallback:with:" : "RK 5/19/2021 10:43", + "requestUser:with:" : "pk 5/21/2021 09:33", "searchChat:" : "f.w. 7/15/2020 22:53", "sendMessage:to:" : "rs 6/13/2020 15:26", "sendPhoneNumber:" : "js 6/13/2020 15:35", "setUserID:" : "per 5/13/2021 08:22", "tryHandleError:" : "pk 5/7/2021 12:23", - "update" : "RS 4/28/2021 18:03" } } + "update" : "RS 4/28/2021 18:03", + "users" : "RK 5/19/2021 09:56", + "users:" : "RK 5/19/2021 09:56" } } diff --git a/packages/TelegramClient-Core.package/TCCCore.class/properties.json b/packages/TelegramClient-Core.package/TCCCore.class/properties.json index 8a149a179..8299c74bf 100644 --- a/packages/TelegramClient-Core.package/TCCCore.class/properties.json +++ b/packages/TelegramClient-Core.package/TCCCore.class/properties.json @@ -9,6 +9,7 @@ "client", "authHandler", "chatsHandler", + "users", "chats", "loggedInUserID", "pendingRequests" ], diff --git a/packages/TelegramClient-Core.package/TCCUsers.class/README.md b/packages/TelegramClient-Core.package/TCCUsers.class/README.md new file mode 100644 index 000000000..16fa34775 --- /dev/null +++ b/packages/TelegramClient-Core.package/TCCUsers.class/README.md @@ -0,0 +1 @@ +Cache of Users allowing for synchronous access. \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCUsers.class/instance/core..st b/packages/TelegramClient-Core.package/TCCUsers.class/instance/core..st new file mode 100644 index 000000000..bd19251b0 --- /dev/null +++ b/packages/TelegramClient-Core.package/TCCUsers.class/instance/core..st @@ -0,0 +1,4 @@ +accessing +core: aCore + + core := aCore \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCUsers.class/instance/core.st b/packages/TelegramClient-Core.package/TCCUsers.class/instance/core.st new file mode 100644 index 000000000..7652dd8d1 --- /dev/null +++ b/packages/TelegramClient-Core.package/TCCUsers.class/instance/core.st @@ -0,0 +1,4 @@ +accessing +core + + ^ core \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCUsers.class/instance/getUserFor..st b/packages/TelegramClient-Core.package/TCCUsers.class/instance/getUserFor..st new file mode 100644 index 000000000..e2329864e --- /dev/null +++ b/packages/TelegramClient-Core.package/TCCUsers.class/instance/getUserFor..st @@ -0,0 +1,10 @@ +accessing +getUserFor: aUserId + + | promise | + promise := self at: aUserId ifAbsent: + [self at: aUserId put: Promise new. + self requestUserFor: aUserId. + self at: aUserId]. + promise wait. + ^ (promise value) \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCUsers.class/instance/requestUserFor..st b/packages/TelegramClient-Core.package/TCCUsers.class/instance/requestUserFor..st new file mode 100644 index 000000000..262553a94 --- /dev/null +++ b/packages/TelegramClient-Core.package/TCCUsers.class/instance/requestUserFor..st @@ -0,0 +1,9 @@ +utility +requestUserFor: aUserId + + self core + registerCallback: + [:userEvent | (self at: aUserId) resolveWith: (TCCUser newFrom: userEvent)] + with: (aUserId asString). + + self core requestUser: aUserId with: aUserId \ No newline at end of file diff --git a/packages/TelegramClient-Core.package/TCCUsers.class/methodProperties.json b/packages/TelegramClient-Core.package/TCCUsers.class/methodProperties.json new file mode 100644 index 000000000..26f3cd403 --- /dev/null +++ b/packages/TelegramClient-Core.package/TCCUsers.class/methodProperties.json @@ -0,0 +1,8 @@ +{ + "class" : { + }, + "instance" : { + "core" : "RK 5/19/2021 10:34", + "core:" : "RK 5/19/2021 10:34", + "getUserFor:" : "pk 5/30/2021 12:55", + "requestUserFor:" : "pk 5/30/2021 13:19" } } diff --git a/packages/TelegramClient-Core.package/TCCUsers.class/properties.json b/packages/TelegramClient-Core.package/TCCUsers.class/properties.json new file mode 100644 index 000000000..e8964e1f9 --- /dev/null +++ b/packages/TelegramClient-Core.package/TCCUsers.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "TelegramClient-Core", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "RK 5/19/2021 09:58", + "instvars" : [ + "core" ], + "name" : "TCCUsers", + "pools" : [ + ], + "super" : "Dictionary", + "type" : "normal" } diff --git a/packages/TelegramClient-Tests.package/TCTAcceptanceTests.class/instance/core..st b/packages/TelegramClient-Tests.package/TCTAcceptanceTests.class/instance/core..st index 3cb1e171e..3844709d3 100644 --- a/packages/TelegramClient-Tests.package/TCTAcceptanceTests.class/instance/core..st +++ b/packages/TelegramClient-Tests.package/TCTAcceptanceTests.class/instance/core..st @@ -1,5 +1,4 @@ accessing core: aCore - aCore when: #newMessageReceived send: #newMessageReceived: to: self. core := aCore. \ No newline at end of file diff --git a/packages/TelegramClient-Tests.package/TCTAcceptanceTests.class/instance/setUp.st b/packages/TelegramClient-Tests.package/TCTAcceptanceTests.class/instance/setUp.st index 03d970a43..d444815af 100644 --- a/packages/TelegramClient-Tests.package/TCTAcceptanceTests.class/instance/setUp.st +++ b/packages/TelegramClient-Tests.package/TCTAcceptanceTests.class/instance/setUp.st @@ -5,4 +5,4 @@ setUp 20 seconds wait. self core authHandler isAuthorizationStateReady ifFalse: [ self core loginWithTestData. - 20 seconds wait]. \ No newline at end of file + 20 seconds wait]. diff --git a/packages/TelegramClient-Tests.package/TCTAcceptanceTests.class/instance/testMessageAuthors.st b/packages/TelegramClient-Tests.package/TCTAcceptanceTests.class/instance/testMessageAuthors.st index 543e3d717..d6030acd9 100644 --- a/packages/TelegramClient-Tests.package/TCTAcceptanceTests.class/instance/testMessageAuthors.st +++ b/packages/TelegramClient-Tests.package/TCTAcceptanceTests.class/instance/testMessageAuthors.st @@ -1,17 +1,22 @@ testing testMessageAuthors - | message user chat_id notification | + | message user notification overrideCore | + "Fake core because some other tests need a working one" + overrideCore := TCTNoTDLibCore new. + overrideCore chats add: (TCCChat new id: TCTMocks mockChatID). + overrideCore when: #newMessageReceived send: #newMessageReceived: to: self. + self receivedMessage: nil. - chat_id := ((self core chats) first) id. - message := TCTMocks mockMessageEventFrom: chat_id. + message := TCTMocks mockMessageEventFrom: TCTMocks mockChatID. - self core handleEvent: message. - user := TCTMocks mockUserWith: (TCTMocks mockMessageID asString, chat_id). - self core handleEvent: user. - + overrideCore handleEvent: message. + 2 seconds wait. + user := TCTMocks mockUserEvent. + overrideCore handleEvent: user. + 1 second wait. notification := TCUNotification newWithMessage: self receivedMessage. - self assert: (TCTMocks mockUserFullName = (notification sender fullName)). - self assert: (chat_id = (notification chat id)). - self assert: (TCTMocks mockMessageText = (notification message message)). \ No newline at end of file + self assert: (TCTMocks mockUserFullName) equals: (notification sender fullName). + self assert: (TCTMocks mockChatID) equals: (notification chat id). + self assert: (TCTMocks mockMessageText) equals: (notification message message) diff --git a/packages/TelegramClient-Tests.package/TCTAcceptanceTests.class/methodProperties.json b/packages/TelegramClient-Tests.package/TCTAcceptanceTests.class/methodProperties.json index e1de77960..9308aa12b 100644 --- a/packages/TelegramClient-Tests.package/TCTAcceptanceTests.class/methodProperties.json +++ b/packages/TelegramClient-Tests.package/TCTAcceptanceTests.class/methodProperties.json @@ -3,7 +3,7 @@ }, "instance" : { "core" : "pk 5/17/2021 15:28", - "core:" : "pk 5/17/2021 19:19", + "core:" : "pk 5/30/2021 20:40", "defaultTimeout" : "RS 5/27/2021 21:13", "newMessageReceived:" : "pk 5/17/2021 19:20", "receivedMessage" : "pk 5/17/2021 19:15", @@ -13,4 +13,4 @@ "testCanCloseChatInfoPage" : "RS 5/28/2021 10:55", "testCanOpenChatInfoPage" : "RS 5/28/2021 10:50", "testChatInfoPageIsHidden" : "RS 5/28/2021 10:51", - "testMessageAuthors" : "JB 5/27/2021 09:54" } } + "testMessageAuthors" : "pk 5/30/2021 21:08" } } diff --git a/packages/TelegramClient-Tests.package/TCTMocks.class/class/mockUserWith..st b/packages/TelegramClient-Tests.package/TCTMocks.class/class/mockUserEvent.st similarity index 77% rename from packages/TelegramClient-Tests.package/TCTMocks.class/class/mockUserWith..st rename to packages/TelegramClient-Tests.package/TCTMocks.class/class/mockUserEvent.st index 5a2c43ba6..fca052ddb 100644 --- a/packages/TelegramClient-Tests.package/TCTMocks.class/class/mockUserWith..st +++ b/packages/TelegramClient-Tests.package/TCTMocks.class/class/mockUserEvent.st @@ -1,5 +1,5 @@ -user -mockUserWith: anExtra +accessing +mockUserEvent ^ (TCCEvent newFromTDLibEvent: (Dictionary newFrom: { '@type' -> 'user'. @@ -7,5 +7,5 @@ mockUserWith: anExtra 'first_name' -> self mockUserFirstName. 'last_name' -> self mockUserLastName. 'username' -> self mockUsername. - '@extra' -> anExtra + '@extra' -> (self mockUserID asString) })) \ No newline at end of file diff --git a/packages/TelegramClient-Tests.package/TCTMocks.class/methodProperties.json b/packages/TelegramClient-Tests.package/TCTMocks.class/methodProperties.json index 7acb496fd..6a5b26b68 100644 --- a/packages/TelegramClient-Tests.package/TCTMocks.class/methodProperties.json +++ b/packages/TelegramClient-Tests.package/TCTMocks.class/methodProperties.json @@ -6,11 +6,11 @@ "mockMessageID" : "pk 5/19/2021 11:36", "mockMessageJsonFrom:" : "RS 5/23/2021 17:26", "mockMessageText" : "pk 5/19/2021 11:38", + "mockUserEvent" : "pk 5/30/2021 13:01", "mockUserFirstName" : "pk 5/19/2021 11:38", "mockUserFullName" : "pk 5/19/2021 11:49", "mockUserID" : "pk 5/19/2021 11:34", "mockUserLastName" : "pk 5/19/2021 11:38", - "mockUserWith:" : "pk 5/19/2021 11:41", "mockUsername" : "pk 5/19/2021 11:39" }, "instance" : { } } diff --git a/packages/TelegramClient-Tests.package/TCTNoTDLibCore.class/README.md b/packages/TelegramClient-Tests.package/TCTNoTDLibCore.class/README.md new file mode 100644 index 000000000..089c8b74a --- /dev/null +++ b/packages/TelegramClient-Tests.package/TCTNoTDLibCore.class/README.md @@ -0,0 +1 @@ +A TCTNoTDLibCore is a TCCCore without a client. It cannot make requests and has to be fed every event. \ No newline at end of file diff --git a/packages/TelegramClient-Tests.package/TCTNoTDLibCore.class/instance/initialize.st b/packages/TelegramClient-Tests.package/TCTNoTDLibCore.class/instance/initialize.st new file mode 100644 index 000000000..c8cf7c463 --- /dev/null +++ b/packages/TelegramClient-Tests.package/TCTNoTDLibCore.class/instance/initialize.st @@ -0,0 +1,11 @@ +initialization +initialize + + "override initialize to work without client or tdlib" + self + client: nil; + initializeHandlers; + chats: TCCChats newWithDefaultSorting; + loggedInUserID: 0; + pendingRequests: Dictionary new; + users: (TCCUsers new core: self). \ No newline at end of file diff --git a/packages/TelegramClient-Tests.package/TCTNoTDLibCore.class/instance/initializeHandlers.st b/packages/TelegramClient-Tests.package/TCTNoTDLibCore.class/instance/initializeHandlers.st new file mode 100644 index 000000000..33e6b0a28 --- /dev/null +++ b/packages/TelegramClient-Tests.package/TCTNoTDLibCore.class/instance/initializeHandlers.st @@ -0,0 +1,6 @@ +initialization +initializeHandlers + + self + chatsHandler: (TCCChatsHandler new + app: self). \ No newline at end of file diff --git a/packages/TelegramClient-Tests.package/TCTNoTDLibCore.class/instance/requestUser.with..st b/packages/TelegramClient-Tests.package/TCTNoTDLibCore.class/instance/requestUser.with..st new file mode 100644 index 000000000..b37f1c431 --- /dev/null +++ b/packages/TelegramClient-Tests.package/TCTNoTDLibCore.class/instance/requestUser.with..st @@ -0,0 +1,4 @@ +events +requestUser: aUserId with: aCallbackID + + ^ self \ No newline at end of file diff --git a/packages/TelegramClient-Tests.package/TCTNoTDLibCore.class/methodProperties.json b/packages/TelegramClient-Tests.package/TCTNoTDLibCore.class/methodProperties.json new file mode 100644 index 000000000..ccc97d261 --- /dev/null +++ b/packages/TelegramClient-Tests.package/TCTNoTDLibCore.class/methodProperties.json @@ -0,0 +1,7 @@ +{ + "class" : { + }, + "instance" : { + "initialize" : "pk 5/30/2021 20:52", + "initializeHandlers" : "pk 5/21/2021 09:46", + "requestUser:with:" : "pk 5/21/2021 10:18" } } diff --git a/packages/TelegramClient-Tests.package/TCTNoTDLibCore.class/properties.json b/packages/TelegramClient-Tests.package/TCTNoTDLibCore.class/properties.json new file mode 100644 index 000000000..41e9b4a63 --- /dev/null +++ b/packages/TelegramClient-Tests.package/TCTNoTDLibCore.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "TelegramClient-Tests", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "pk 5/21/2021 09:45", + "instvars" : [ + ], + "name" : "TCTNoTDLibCore", + "pools" : [ + ], + "super" : "TCCCore", + "type" : "normal" } diff --git a/packages/TelegramClient-Tests.package/TCTUsersTests.class/README.md b/packages/TelegramClient-Tests.package/TCTUsersTests.class/README.md new file mode 100644 index 000000000..c5a5a6997 --- /dev/null +++ b/packages/TelegramClient-Tests.package/TCTUsersTests.class/README.md @@ -0,0 +1 @@ +test TCCUsers diff --git a/packages/TelegramClient-Tests.package/TCTUsersTests.class/instance/core..st b/packages/TelegramClient-Tests.package/TCTUsersTests.class/instance/core..st new file mode 100644 index 000000000..9d6b0d8ef --- /dev/null +++ b/packages/TelegramClient-Tests.package/TCTUsersTests.class/instance/core..st @@ -0,0 +1,4 @@ +accessing +core: aTCCCore + + core := aTCCCore \ No newline at end of file diff --git a/packages/TelegramClient-Tests.package/TCTUsersTests.class/instance/core.st b/packages/TelegramClient-Tests.package/TCTUsersTests.class/instance/core.st new file mode 100644 index 000000000..7652dd8d1 --- /dev/null +++ b/packages/TelegramClient-Tests.package/TCTUsersTests.class/instance/core.st @@ -0,0 +1,4 @@ +accessing +core + + ^ core \ No newline at end of file diff --git a/packages/TelegramClient-Tests.package/TCTUsersTests.class/instance/setUp.st b/packages/TelegramClient-Tests.package/TCTUsersTests.class/instance/setUp.st new file mode 100644 index 000000000..20afdd9dc --- /dev/null +++ b/packages/TelegramClient-Tests.package/TCTUsersTests.class/instance/setUp.st @@ -0,0 +1,5 @@ +running +setUp + + self core: TCTNoTDLibCore new. + self users: self core users. diff --git a/packages/TelegramClient-Tests.package/TCTUsersTests.class/instance/testGetUserFor.st b/packages/TelegramClient-Tests.package/TCTUsersTests.class/instance/testGetUserFor.st new file mode 100644 index 000000000..f275a4f0b --- /dev/null +++ b/packages/TelegramClient-Tests.package/TCTUsersTests.class/instance/testGetUserFor.st @@ -0,0 +1,15 @@ +testing +testGetUserFor + + | user | + user := nil. + [user := self users getUserFor: TCTMocks mockUserID.] fork. + 1 seconds wait. + + self core handleEvent: TCTMocks mockUserEvent. + 1 seconds wait. + + self assert: TCTMocks mockUserID equals: user id. + self assert: TCTMocks mockUserFirstName equals: user firstName. + self assert: TCTMocks mockUserLastName equals: user lastName. + self assert: TCTMocks mockUsername equals: user username. \ No newline at end of file diff --git a/packages/TelegramClient-Tests.package/TCTUsersTests.class/instance/users..st b/packages/TelegramClient-Tests.package/TCTUsersTests.class/instance/users..st new file mode 100644 index 000000000..ce7986d38 --- /dev/null +++ b/packages/TelegramClient-Tests.package/TCTUsersTests.class/instance/users..st @@ -0,0 +1,4 @@ +accessing +users: aUsers + + users := aUsers \ No newline at end of file diff --git a/packages/TelegramClient-Tests.package/TCTUsersTests.class/instance/users.st b/packages/TelegramClient-Tests.package/TCTUsersTests.class/instance/users.st new file mode 100644 index 000000000..642c96219 --- /dev/null +++ b/packages/TelegramClient-Tests.package/TCTUsersTests.class/instance/users.st @@ -0,0 +1,4 @@ +accessing +users + + ^ users \ No newline at end of file diff --git a/packages/TelegramClient-Tests.package/TCTUsersTests.class/methodProperties.json b/packages/TelegramClient-Tests.package/TCTUsersTests.class/methodProperties.json new file mode 100644 index 000000000..f2e26b236 --- /dev/null +++ b/packages/TelegramClient-Tests.package/TCTUsersTests.class/methodProperties.json @@ -0,0 +1,10 @@ +{ + "class" : { + }, + "instance" : { + "core" : "RK 5/19/2021 10:29", + "core:" : "RK 5/19/2021 10:29", + "setUp" : "pk 5/30/2021 21:11", + "testGetUserFor" : "pk 5/30/2021 21:11", + "users" : "RK 5/19/2021 10:29", + "users:" : "RK 5/19/2021 10:30" } } diff --git a/packages/TelegramClient-Tests.package/TCTUsersTests.class/properties.json b/packages/TelegramClient-Tests.package/TCTUsersTests.class/properties.json new file mode 100644 index 000000000..3295a617f --- /dev/null +++ b/packages/TelegramClient-Tests.package/TCTUsersTests.class/properties.json @@ -0,0 +1,15 @@ +{ + "category" : "TelegramClient-Tests", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "RK 5/19/2021 10:18", + "instvars" : [ + "users", + "core" ], + "name" : "TCTUsersTests", + "pools" : [ + ], + "super" : "TestCase", + "type" : "normal" }