Skip to content

Commit

Permalink
test: improve result service tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gibiw committed Sep 24, 2024
1 parent a5002ab commit 5183c1f
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,14 @@ install:

.PHONY: coverage
coverage:
@go test -coverprofile=coverage.out ./...
@go test ./... -coverprofile=coverage.out
@go tool cover -func=coverage.out

.PHONY: coverhtml
coverhtml:
@go test ./... -coverprofile=coverage.out
@go tool cover -html=coverage.out

.PHONY: docker
docker:
@docker build -t ghcr.io/qase-tms/qase-cli:$(version) -t ghcr.io/qase-tms/qase-cli:$latest -f ./build/Dockerfile --build-arg VERSION=$(version) .
42 changes: 42 additions & 0 deletions internal/service/result/result_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,40 @@ func TestService_Upload(t *testing.T) {
Description: "description",
RunID: 0,
Batch: 20,
Suite: "",
},
err: nil,
isUsed: true,
count: 1,
runID: 1,
},
pArgs: pArgs{
models: prepareModels(),
err: nil,
isUsed: true,
},
rArgs: rArgs{
model: 1,
err: nil,
isUsed: true,
},
cArgs: cArgs{
err: nil,
isUsed: true,
},
wantErr: false,
errMessage: "",
},
{
name: "success with create test run and suite",
args: args{
p: UploadParams{
Project: "project",
Title: "title",
Description: "description",
RunID: 0,
Batch: 20,
Suite: "suite",
},
err: nil,
isUsed: true,
Expand Down Expand Up @@ -80,6 +114,7 @@ func TestService_Upload(t *testing.T) {
Description: "description",
RunID: 1,
Batch: 20,
Suite: "",
},
err: nil,
isUsed: true,
Expand Down Expand Up @@ -112,6 +147,7 @@ func TestService_Upload(t *testing.T) {
Description: "description",
RunID: 1,
Batch: 20,
Suite: "",
},
err: nil,
isUsed: false,
Expand Down Expand Up @@ -144,6 +180,7 @@ func TestService_Upload(t *testing.T) {
Description: "description",
RunID: 1,
Batch: 20,
Suite: "",
},
err: nil,
isUsed: false,
Expand Down Expand Up @@ -176,6 +213,7 @@ func TestService_Upload(t *testing.T) {
Description: "description",
RunID: 0,
Batch: 20,
Suite: "",
},
err: nil,
isUsed: false,
Expand Down Expand Up @@ -208,6 +246,7 @@ func TestService_Upload(t *testing.T) {
Description: "description",
RunID: 0,
Batch: 1,
Suite: "",
},
err: nil,
isUsed: true,
Expand Down Expand Up @@ -240,6 +279,7 @@ func TestService_Upload(t *testing.T) {
Description: "description",
RunID: 0,
Batch: 1,
Suite: "",
},
err: errors.New("failed upload data"),
isUsed: true,
Expand Down Expand Up @@ -272,6 +312,7 @@ func TestService_Upload(t *testing.T) {
Description: "description",
RunID: 0,
Batch: 20,
Suite: "",
},
err: errors.New("failed upload data"),
isUsed: true,
Expand Down Expand Up @@ -304,6 +345,7 @@ func TestService_Upload(t *testing.T) {
Description: "description",
RunID: 0,
Batch: 20,
Suite: "",
},
err: nil,
isUsed: true,
Expand Down

0 comments on commit 5183c1f

Please sign in to comment.