-
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.
TestCore implements TestSpy pattern (#393)
* make TestCore implement the Test Spy pattern and add a test * refactor TestCore query methods * revert 793dce5 but keep the refactored interface
- Loading branch information
1 parent
b135684
commit 5bdd69b
Showing
11 changed files
with
58 additions
and
4 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
...-Core.package/TCTCAPITests.class/instance/testPositionIsUpdatedAfterInitialChatLoading.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,16 @@ | ||
testing | ||
testPositionIsUpdatedAfterInitialChatLoading | ||
|
||
| testChat newChatEvent updatePositionEvent | | ||
|
||
testChat := self sharedCore chats first. | ||
self assert: testChat positionKnown. | ||
|
||
newChatEvent := (self sharedCore loggedEventsSatisfying: | ||
[:anEvent | anEvent type = 'updateNewChat' and: [((anEvent at: 'chat') at: 'id') = testChat id]]) | ||
first. | ||
updatePositionEvent := (self sharedCore loggedEventsSatisfying: | ||
[:anEvent | anEvent type = 'updateChatPosition' and: [(anEvent at: 'chat_id') = testChat id]]) | ||
first. | ||
|
||
self assert: (self sharedCore chronologicalPositionOf: newChatEvent) < (self sharedCore chronologicalPositionOf: updatePositionEvent). |
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/TelegramClientTests-Core.package/TCTCTestCore.class/README.md
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 +1 @@ | ||
Creates a TestApp using Telegram TestDatabase Service | ||
Creates a TestApp using Telegram TestDatabase Service and saves all received events in-order in a log. |
9 changes: 9 additions & 0 deletions
9
.../TelegramClientTests-Core.package/TCTCTestCore.class/instance/chronologicalPositionOf..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,9 @@ | ||
event log querying | ||
chronologicalPositionOf: anEvent | ||
|
||
| position | | ||
|
||
position := self eventLog findFirst: [:anotherEvent | anotherEvent = anEvent]. | ||
self assert: (position = 0) not. | ||
|
||
^ position |
4 changes: 4 additions & 0 deletions
4
packages/TelegramClientTests-Core.package/TCTCTestCore.class/instance/eventLog..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 @@ | ||
accessing | ||
eventLog: anOrderedCollection | ||
|
||
eventLog := anOrderedCollection |
4 changes: 4 additions & 0 deletions
4
packages/TelegramClientTests-Core.package/TCTCTestCore.class/instance/eventLog.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 @@ | ||
accessing | ||
eventLog | ||
|
||
^ eventLog |
5 changes: 5 additions & 0 deletions
5
packages/TelegramClientTests-Core.package/TCTCTestCore.class/instance/handleEvent..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,5 @@ | ||
events | ||
handleEvent: anEvent | ||
|
||
self eventLog add: anEvent. | ||
^ super handleEvent: anEvent |
5 changes: 5 additions & 0 deletions
5
packages/TelegramClientTests-Core.package/TCTCTestCore.class/instance/initialize.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,5 @@ | ||
initialization | ||
initialize | ||
|
||
self eventLog: OrderedCollection new. | ||
super initialize. |
4 changes: 4 additions & 0 deletions
4
...s/TelegramClientTests-Core.package/TCTCTestCore.class/instance/loggedEventsSatisfying..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 @@ | ||
event log querying | ||
loggedEventsSatisfying: aBlock | ||
|
||
^ self eventLog select: aBlock |
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
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