Skip to content

Commit 0633722

Browse files
committed
Fix tests
1 parent 07a94f0 commit 0633722

1 file changed

Lines changed: 19 additions & 3 deletions

File tree

miner/src/test/java/fr/rakambda/channelpointsminer/miner/api/twitch/TwitchApiTest.java

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ void setUp(UnirestMock unirestMock) throws MalformedURLException{
9999

100100
@Test
101101
void sendMinutesWatched(UnirestMock unirest){
102-
var json = "[{\"event\":\"minute-watched\",\"properties\":{\"broadcast_id\":\"%s\",\"channel\":\"%s\",\"channel_id\":\"%s\",\"live\":true,\"player\":\"%s\",\"user_id\":%d}}]"
102+
var json = "[{\"event\":\"minute-watched\",\"properties\":{\"broadcast_id\":\"%s\",\"channel\":\"%s\",\"channel_id\":\"%s\",\"hidden\":false,\"live\":true,\"location\":\"channel\",\"logged_in\":true,\"muted\":false,\"player\":\"%s\",\"user_id\":%d}}]"
103103
.formatted(BROADCAST_ID, CHANNEL_NAME, CHANNEL_ID, PLAYER, USER_ID);
104104
var expectedData = new String(Base64.getEncoder().encode(json.getBytes(UTF_8)));
105105

@@ -116,6 +116,10 @@ void sendMinutesWatched(UnirestMock unirest){
116116
.channel(CHANNEL_NAME)
117117
.player(PLAYER)
118118
.live(true)
119+
.hidden(false)
120+
.loggedIn(true)
121+
.muted(false)
122+
.location("channel")
119123
.build())
120124
.build();
121125
assertThat(tested.sendPlayerEvents(spadeUrl, request)).isTrue();
@@ -125,7 +129,7 @@ void sendMinutesWatched(UnirestMock unirest){
125129

126130
@Test
127131
void sendMinutesWatchedWithGame(UnirestMock unirest){
128-
var json = "[{\"event\":\"minute-watched\",\"properties\":{\"broadcast_id\":\"%s\",\"channel\":\"%s\",\"channel_id\":\"%s\",\"game\":\"%s\",\"game_id\":\"%s\",\"live\":true,\"player\":\"%s\",\"user_id\":%d}}]"
132+
var json = "[{\"event\":\"minute-watched\",\"properties\":{\"broadcast_id\":\"%s\",\"channel\":\"%s\",\"channel_id\":\"%s\",\"game\":\"%s\",\"game_id\":\"%s\",\"hidden\":false,\"live\":true,\"location\":\"channel\",\"logged_in\":true,\"muted\":false,\"player\":\"%s\",\"user_id\":%d}}]"
129133
.formatted(BROADCAST_ID, CHANNEL_NAME, CHANNEL_ID, GAME, GAME_ID, PLAYER, USER_ID);
130134
var expectedData = new String(Base64.getEncoder().encode(json.getBytes(UTF_8)));
131135

@@ -144,6 +148,10 @@ void sendMinutesWatchedWithGame(UnirestMock unirest){
144148
.game(GAME)
145149
.gameId(GAME_ID)
146150
.live(true)
151+
.hidden(false)
152+
.loggedIn(true)
153+
.muted(false)
154+
.location("channel")
147155
.build())
148156
.build();
149157
assertThat(tested.sendPlayerEvents(spadeUrl, request)).isTrue();
@@ -153,7 +161,7 @@ void sendMinutesWatchedWithGame(UnirestMock unirest){
153161

154162
@Test
155163
void sendMinutesWatchedNotSuccess(UnirestMock unirest){
156-
var json = "[{\"event\":\"minute-watched\",\"properties\":{\"broadcast_id\":\"%s\",\"channel\":\"%s\",\"channel_id\":\"%s\",\"live\":true,\"player\":\"%s\",\"user_id\":%d}}]"
164+
var json = "[{\"event\":\"minute-watched\",\"properties\":{\"broadcast_id\":\"%s\",\"channel\":\"%s\",\"channel_id\":\"%s\",\"hidden\":false,\"live\":true,\"location\":\"channel\",\"logged_in\":true,\"muted\":false,\"player\":\"%s\",\"user_id\":%d}}]"
157165
.formatted(BROADCAST_ID, CHANNEL_NAME, CHANNEL_ID, PLAYER, USER_ID);
158166
var expectedData = new String(Base64.getEncoder().encode(json.getBytes(UTF_8)));
159167

@@ -170,6 +178,10 @@ void sendMinutesWatchedNotSuccess(UnirestMock unirest){
170178
.channel(CHANNEL_NAME)
171179
.player(PLAYER)
172180
.live(true)
181+
.hidden(false)
182+
.loggedIn(true)
183+
.muted(false)
184+
.location("channel")
173185
.build())
174186
.build();
175187
assertThat(tested.sendPlayerEvents(spadeUrl, request)).isFalse();
@@ -192,6 +204,10 @@ void sendMinutesWatchedJsonError(){
192204
.channel(CHANNEL_NAME)
193205
.player(PLAYER)
194206
.live(true)
207+
.hidden(false)
208+
.loggedIn(true)
209+
.muted(false)
210+
.location("channel")
195211
.build())
196212
.build();
197213
assertThat(tested.sendPlayerEvents(spadeUrl, request)).isFalse();

0 commit comments

Comments
 (0)