Skip to content

Commit

Permalink
chore: Fix cloudflare purging test
Browse files Browse the repository at this point in the history
  • Loading branch information
JanCizmar committed Sep 20, 2024
1 parent cd3c27c commit a92080b
Showing 1 changed file with 23 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class CloudflareContentStorageConfigCachePurgingTest() {
urlPrefix = "fake-url-prefix",
maxFilesPerRequest = 10,
apiKey = "token",
origins = "fake-origin,fake-origin2",
)
val restTemplateMock: RestTemplate = mock()
val purging = CloudflareContentDeliveryCachePurging(config, restTemplateMock)
Expand All @@ -51,14 +52,33 @@ class CloudflareContentStorageConfigCachePurgingTest() {
assertFiles(firstInvocation) {
isArray
.hasSize(10)
.contains("fake-url-prefix/fake-slug/fake-path-1")
node("[0]") {
node("headers").isEqualTo(
mapOf(
"Origin" to "fake-origin",
),
)
node("url").isEqualTo("fake-url-prefix/fake-slug/fake-path-1")
}
node("[1]") {
node("headers").isEqualTo(
mapOf(
"Origin" to "fake-origin2",
),
)
}
}
assertUrl(firstInvocation)
assertAuthorizationHeader(firstInvocation)

assertFiles(invocations.toList()[1]) {
isArray.hasSize(5)
val invocationList = invocations.toList()
assertFiles(invocationList[1]) {
isArray.hasSize(10)
}
assertFiles(invocationList[2]) {
isArray.hasSize(10)
}
invocationList.assert.hasSize(3)
}

private fun assertFiles(
Expand Down

0 comments on commit a92080b

Please sign in to comment.