Skip to content

Commit

Permalink
refactor: use mock helper in _pure_k8s_context and _pure_k8s_namespac…
Browse files Browse the repository at this point in the history
…e tests
  • Loading branch information
edouard-lopez committed Aug 14, 2023
1 parent 020a1a7 commit 5265647
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
8 changes: 4 additions & 4 deletions tests/_pure_k8s_context.test.fish
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
source (dirname (status filename))/fixtures/constants.fish
source (dirname (status filename))/mocks/mocks.fish
source (dirname (status filename))/../functions/_pure_k8s_context.fish
@echo (_print_filename (status filename))

Expand All @@ -11,12 +12,11 @@ end

before_each
@test "_pure_k8s_context: return context" (
function kubectl
echo foo-bar-cluster-eu-west-3
end # mock
_mock kubectl


_pure_k8s_context
) = foo-bar-cluster-eu-west-3
) = my-context

before_each
@test "_pure_k8s_context: call `kubectl config current-context`" (
Expand Down
5 changes: 2 additions & 3 deletions tests/_pure_k8s_namespace.test.fish
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
source (dirname (status filename))/fixtures/constants.fish
source (dirname (status filename))/mocks/mocks.fish
source (dirname (status filename))/../functions/_pure_k8s_namespace.fish
@echo (_print_filename (status filename))

Expand All @@ -11,9 +12,7 @@ end

before_each
@test "_pure_k8s_namespace: return context" (
function kubectl
echo my-namespace
end # mock
_mock kubectl

_pure_k8s_namespace
) = my-namespace
Expand Down

0 comments on commit 5265647

Please sign in to comment.