Skip to content

Commit

Permalink
fix: new id for DropsHighlightService_AvailableDrops gql request (#426)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rakambda authored Feb 16, 2023
1 parent 7c4b74a commit d62ecbe
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 97 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
@EqualsAndHashCode(callSuper = true)
@ToString
public class DropsHighlightServiceAvailableDropsOperation extends IGQLOperation<DropsHighlightServiceAvailableDropsData>{
public DropsHighlightServiceAvailableDropsOperation(@NotNull String channelId){
super("DropsHighlightService_AvailableDrops");
addPersistedQueryExtension(new PersistedQueryExtension(1, "b19ee96a0e79e3f8281c4108bc4c7b3f232266db6f96fd04a339ab393673a075"));
addVariable("channelID", channelId);
}
@Override
@NotNull
public GenericType<GQLResponse<DropsHighlightServiceAvailableDropsData>> getResponseType(){
return new GenericType<>(){};
}
public DropsHighlightServiceAvailableDropsOperation(@NotNull String channelId){
super("DropsHighlightService_AvailableDrops");
addPersistedQueryExtension(new PersistedQueryExtension(1, "e589e213f16d9b17c6f0a8ccd18bdd6a8a6b78bc9db67a75efd43793884ff4e5"));
addVariable("channelID", channelId);
}
@Override
@NotNull
public GenericType<GQLResponse<DropsHighlightServiceAvailableDropsData>> getResponseType(){
return new GenericType<>(){};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,90 +26,90 @@
@ExtendWith(MockitoExtension.class)
@ExtendWith(UnirestMockExtension.class)
class GQLApiDropsHighlightServiceAvailableDropsTest extends AbstractGQLTest{
private static final String STREAMER_ID = "streamer-id";
@Test
void nominalWithDrops(UnirestMock unirest) throws MalformedURLException{
var game = Game.builder()
.id("159357")
.name("game-name")
.build();
var expected = GQLResponse.<DropsHighlightServiceAvailableDropsData> builder()
.extensions(Map.of(
"durationMilliseconds", 31,
"operationName", "DropsHighlightService_AvailableDrops",
"requestID", "request-id"
))
.data(DropsHighlightServiceAvailableDropsData.builder()
.channel(Channel.builder()
.id("123456789")
.viewerDropCampaigns(List.of(DropCampaign.builder()
.id("campaign-id")
.name("campaign-name")
.game(game)
.detailsUrl(new URL("https://google.com/campaign-info"))
.endAt(ZonedDateTime.of(2021, 10, 11, 5, 0, 0, 0, UTC))
.imageUrl(new URL("https://google.com/campaign-image"))
.timeBasedDrops(List.of(TimeBasedDrop.builder()
.id("drop-id")
.name("drop-name")
.startAt(ZonedDateTime.of(2021, 10, 4, 15, 0, 0, 0, UTC))
.endAt(ZonedDateTime.of(2021, 10, 11, 5, 0, 0, 0, UTC))
.benefitEdges(List.of(DropBenefitEdge.builder()
.benefit(DropBenefit.builder()
.id("benefit-id")
.name("benefit-name")
.game(game)
.imageAssetUrl(new URL("https://google.com/drop-image"))
.build())
.entitlementLimit(1)
.build()))
.requiredMinutesWatched(240)
.build()))
.build()))
.build())
.currentUser(User.builder()
.id("987654321")
.inventory(Inventory.builder().build())
.build())
.build())
.build();
expectValidRequestOkWithIntegrityOk("api/gql/gql/dropsHighlightServiceAvailableDrops_withDrops.json");
assertThat(tested.dropsHighlightServiceAvailableDrops(STREAMER_ID)).isPresent().get().isEqualTo(expected);
verifyAll();
}
@Test
void nominalNoDrops(){
var expected = GQLResponse.<DropsHighlightServiceAvailableDropsData> builder()
.extensions(Map.of(
"durationMilliseconds", 31,
"operationName", "DropsHighlightService_AvailableDrops",
"requestID", "request-id"
))
.data(DropsHighlightServiceAvailableDropsData.builder()
.channel(Channel.builder()
.id("123456789")
.build())
.currentUser(User.builder()
.id("987654321")
.inventory(Inventory.builder().build())
.build())
.build())
.build();
expectValidRequestOkWithIntegrityOk("api/gql/gql/dropsHighlightServiceAvailableDrops_noDrops.json");
assertThat(tested.dropsHighlightServiceAvailableDrops(STREAMER_ID)).isPresent().get().isEqualTo(expected);
verifyAll();
}
@Override
protected String getValidRequest(){
return "{\"extensions\":{\"persistedQuery\":{\"sha256Hash\":\"b19ee96a0e79e3f8281c4108bc4c7b3f232266db6f96fd04a339ab393673a075\",\"version\":1}},\"operationName\":\"DropsHighlightService_AvailableDrops\",\"variables\":{\"channelID\":\"%s\"}}".formatted(STREAMER_ID);
}
private static final String STREAMER_ID = "streamer-id";
@Test
void nominalWithDrops(UnirestMock unirest) throws MalformedURLException{
var game = Game.builder()
.id("159357")
.name("game-name")
.build();
var expected = GQLResponse.<DropsHighlightServiceAvailableDropsData> builder()
.extensions(Map.of(
"durationMilliseconds", 31,
"operationName", "DropsHighlightService_AvailableDrops",
"requestID", "request-id"
))
.data(DropsHighlightServiceAvailableDropsData.builder()
.channel(Channel.builder()
.id("123456789")
.viewerDropCampaigns(List.of(DropCampaign.builder()
.id("campaign-id")
.name("campaign-name")
.game(game)
.detailsUrl(new URL("https://google.com/campaign-info"))
.endAt(ZonedDateTime.of(2021, 10, 11, 5, 0, 0, 0, UTC))
.imageUrl(new URL("https://google.com/campaign-image"))
.timeBasedDrops(List.of(TimeBasedDrop.builder()
.id("drop-id")
.name("drop-name")
.startAt(ZonedDateTime.of(2021, 10, 4, 15, 0, 0, 0, UTC))
.endAt(ZonedDateTime.of(2021, 10, 11, 5, 0, 0, 0, UTC))
.benefitEdges(List.of(DropBenefitEdge.builder()
.benefit(DropBenefit.builder()
.id("benefit-id")
.name("benefit-name")
.game(game)
.imageAssetUrl(new URL("https://google.com/drop-image"))
.build())
.entitlementLimit(1)
.build()))
.requiredMinutesWatched(240)
.build()))
.build()))
.build())
.currentUser(User.builder()
.id("987654321")
.inventory(Inventory.builder().build())
.build())
.build())
.build();
expectValidRequestOkWithIntegrityOk("api/gql/gql/dropsHighlightServiceAvailableDrops_withDrops.json");
assertThat(tested.dropsHighlightServiceAvailableDrops(STREAMER_ID)).isPresent().get().isEqualTo(expected);
verifyAll();
}
@Test
void nominalNoDrops(){
var expected = GQLResponse.<DropsHighlightServiceAvailableDropsData> builder()
.extensions(Map.of(
"durationMilliseconds", 31,
"operationName", "DropsHighlightService_AvailableDrops",
"requestID", "request-id"
))
.data(DropsHighlightServiceAvailableDropsData.builder()
.channel(Channel.builder()
.id("123456789")
.build())
.currentUser(User.builder()
.id("987654321")
.inventory(Inventory.builder().build())
.build())
.build())
.build();
expectValidRequestOkWithIntegrityOk("api/gql/gql/dropsHighlightServiceAvailableDrops_noDrops.json");
assertThat(tested.dropsHighlightServiceAvailableDrops(STREAMER_ID)).isPresent().get().isEqualTo(expected);
verifyAll();
}
@Override
protected String getValidRequest(){
return "{\"extensions\":{\"persistedQuery\":{\"sha256Hash\":\"e589e213f16d9b17c6f0a8ccd18bdd6a8a6b78bc9db67a75efd43793884ff4e5\",\"version\":1}},\"operationName\":\"DropsHighlightService_AvailableDrops\",\"variables\":{\"channelID\":\"%s\"}}".formatted(STREAMER_ID);
}
}

0 comments on commit d62ecbe

Please sign in to comment.