Skip to content

Commit

Permalink
Add testdata to fix unit tests
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Demeester <[email protected]>
  • Loading branch information
vdemeester committed Jan 25, 2024
1 parent 47ef305 commit 98854ec
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 4 deletions.
4 changes: 2 additions & 2 deletions internal/contract/contract_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ func TestNewContractFromFile(t *testing.T) {
g := o.NewWithT(t)

t.Run("Filename", func(_ *testing.T) {
c, err := NewContractFromFile("../../test/resources/.catalog.yaml")
c, err := NewContractFromFile("../../testdata/resources/.catalog.yaml")
g.Expect(err).To(o.BeNil())
g.Expect(c.Catalog.Resources).ToNot(o.BeNil())
})

t.Run("Directory", func(_ *testing.T) {
c, err := NewContractFromFile("../../test/resources")
c, err := NewContractFromFile("../../testdata/resources")
g.Expect(err).To(o.BeNil())
g.Expect(c.Catalog.Resources).ToNot(o.BeNil())
})
Expand Down
2 changes: 1 addition & 1 deletion internal/linter/linter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func TestNewLinter(t *testing.T) {

cfg := config.NewConfig()

l, err := NewLinter(cfg, "../../test/resources/task.yaml")
l, err := NewLinter(cfg, "../../testdata/resources/task.yaml")
g.Expect(err).To(o.Succeed())
g.Expect(l).NotTo(o.BeNil())

Expand Down
2 changes: 1 addition & 1 deletion internal/render/markdown_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func TestNewMarkdow(t *testing.T) {

cfg := config.NewConfig()

m, err := NewMarkdown(cfg, "../../test/resources/task.yaml")
m, err := NewMarkdown(cfg, "../../testdata/resources/task.yaml")
g.Expect(err).To(o.Succeed())
g.Expect(m).NotTo(o.BeNil())

Expand Down
17 changes: 17 additions & 0 deletions testdata/resources/.catalog.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: v1
catalog:
repository:
description: ""
attestation:
publickey: ""
resources:
tasks:
- name: task
version: 0.0.1
filename: ../../test/resources/task.yaml
checksum: f2d507741e983223beb94b5411264004e8d2cbbf0326a716c8313002e505e706
signature: ""
pipelines: []
probe:
tasks: []
pipelines: []
76 changes: 76 additions & 0 deletions testdata/resources/task.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: task
spec:
description: |
Task description.
workspaces:
- name: required-workspace
description: |
Workspace "required-workspace" description.
- name: optional-workspace
optional: true
description: |
Workspace "optional-workspace" description.
params:
- name: STRING_PARAM
type: string
description: |
String parameter description.
- name: STRING_PARAM_EMPTY
type: string
default: ""
description: |
String parameter description.
- name: STRING_PARAM_WITH_DEFAULT
type: string
default: default
description: |
String parameter description.
- name: ARRAY_PARAM
type: array
description: |
Array parameter description.
- name: ARRAY_PARAM_EMPTY
type: array
default: []
description: |
Array parameter description.
- name: ARRAY_PARAM_WITH_DEFAULT
type: array
default:
- entry
description: |
Array parameter description.
- name: OBJECT_PARAM
type: object
description: |
Object parameter description.
- name: OBJECT_PARAM_EMPTY
type: object
properties:
key:
type: string
default:
key: ""
description: |
Object parameter description.
- name: OBJECT_PARAM_WITH_DEFAULT
type: object
properties:
key:
type: string
default:
key: value
description: |
Object parameter description.
results:
- name: RESULT
description: |
Result description.

0 comments on commit 98854ec

Please sign in to comment.