suite: plugin-theme-park middleware test
templates:
  - common.yaml
release:
  name: test-release-name
  namespace: test-release-namespace
tests:
  - it: should pass with all set
    set:
      ingressMiddlewares:
        traefik:
          my-middleware1:
            enabled: true
            type: plugin-theme-park
            data:
              app: sonarr
              theme: dark
              baseUrl: https://example.com
              addons:
                - some-addon
                - some-other-addon
    asserts:
      - documentIndex: &middlewareDoc 0
        equal:
          path: spec
          value:
            plugin:
              traefik-themepark:
                app: sonarr
                theme: dark
                baseUrl: https://example.com
                addons:
                  - some-addon
                  - some-other-addon

  - it: should pass with pluginName set
    set:
      ingressMiddlewares:
        traefik:
          my-middleware1:
            enabled: true
            type: plugin-theme-park
            data:
              app: sonarr
              theme: dark
              pluginName: traefik-themepark-test
    asserts:
      - documentIndex: *middlewareDoc
        equal:
          path: spec
          value:
            plugin:
              traefik-themepark-test:
                app: sonarr
                theme: dark

  - it: should fail with missing app
    set:
      ingressMiddlewares:
        traefik:
          my-middleware1:
            enabled: true
            type: plugin-theme-park
            data:
              theme: dark
    asserts:
      - failedTemplate:
          errorMessage: Middleware (themepark) - Expected [app] to be set

  - it: should fail with missing theme
    set:
      ingressMiddlewares:
        traefik:
          my-middleware1:
            enabled: true
            type: plugin-theme-park
            data:
              app: sonarr
    asserts:
      - failedTemplate:
          errorMessage: Middleware (themepark) - Expected [theme] to be set
