@@ -249,14 +249,15 @@ var _ = Describe("ResourceData Version Compatibility", func() {
249
249
250
250
var _ = Describe ("Config" , func () {
251
251
var (
252
- c * Config
253
- gvk1 , gvk2 ResourceData
252
+ c * Config
253
+ gvk1 , gvk2 , gvk3 ResourceData
254
254
)
255
255
256
256
BeforeEach (func () {
257
257
c = & Config {}
258
258
gvk1 = ResourceData {Group : "example" , Version : "v1" , Kind : "TestKind" }
259
259
gvk2 = ResourceData {Group : "example" , Version : "v1" , Kind : "TestKind2" }
260
+ gvk3 = ResourceData {Group : "example" , Version : "v1" , Kind : "TestKind" , Webhooks : & Webhooks {WebhookVersion : v1beta1 }}
260
261
})
261
262
262
263
Context ("UpdateResource" , func () {
@@ -295,4 +296,17 @@ var _ = Describe("Config", func() {
295
296
})
296
297
297
298
})
299
+
300
+ Context ("HasWebhook" , func () {
301
+ It ("should return true when config has a webhook for the GVK" , func () {
302
+ c .UpdateResources (gvk3 )
303
+ Expect (c .Resources ).To (Equal ([]ResourceData {gvk3 }))
304
+ Expect (c .HasWebhook (gvk3 )).To (BeTrue ())
305
+ })
306
+ It ("should return false when config does not have a webhook for the GVK" , func () {
307
+ c .UpdateResources (gvk1 )
308
+ Expect (c .Resources ).To (Equal ([]ResourceData {gvk1 }))
309
+ Expect (c .HasWebhook (gvk1 )).To (BeFalse ())
310
+ })
311
+ })
298
312
})
0 commit comments