Skip to content

Commit 22807a0

Browse files
committed
Adjust tests
1 parent d07c04c commit 22807a0

File tree

3 files changed

+35
-3
lines changed

3 files changed

+35
-3
lines changed

models/fixtures/action_run.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,22 @@
5555
updated: 1683636626
5656
need_approval: 0
5757
approved_by: 0
58+
-
59+
id: 794
60+
title: "job output"
61+
repo_id: 4
62+
owner_id: 1
63+
workflow_id: "test.yaml"
64+
index: 190
65+
trigger_user_id: 1
66+
ref: "refs/heads/test"
67+
commit_sha: "c2d72f548424103f01ee1dc02889c1e2bff816b0"
68+
event: "push"
69+
is_fork_pull_request: 0
70+
status: 1
71+
started: 1683636528
72+
stopped: 1683636626
73+
created: 1683636108
74+
updated: 1683636626
75+
need_approval: 0
76+
approved_by: 0

models/fixtures/branch.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,15 @@
8181
is_deleted: false
8282
deleted_by_id: 0
8383
deleted_unix: 0
84+
85+
-
86+
id: 15
87+
repo_id: 4
88+
name: 'master'
89+
commit_id: 'c7cd3cd144e6d23c9d6f3d07e52b2c1a956e0338'
90+
commit_message: 'add Readme'
91+
commit_time: 1588147171
92+
pusher_id: 13
93+
is_deleted: false
94+
deleted_by_id: 0
95+
deleted_unix: 0

routers/web/repo/actions/actions_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,11 @@ func TestReadWorkflow_WorkflowDispatchConfig(t *testing.T) {
161161
func Test_loadIsRefDeleted(t *testing.T) {
162162
unittest.PrepareTestEnv(t)
163163

164-
runs, total, err := db.FindAndCount[actions_model.ActionRun](db.DefaultContext, actions_model.FindRunOptions{RepoID: 4})
164+
runs, total, err := db.FindAndCount[actions_model.ActionRun](db.DefaultContext,
165+
actions_model.FindRunOptions{RepoID: 4, Ref: "refs/heads/test"})
165166
assert.NoError(t, err)
166-
assert.Len(t, runs, 3)
167-
assert.EqualValues(t, 3, total)
167+
assert.Len(t, runs, 1)
168+
assert.EqualValues(t, 1, total)
168169
for _, run := range runs {
169170
assert.False(t, run.IsRefDeleted)
170171
}

0 commit comments

Comments
 (0)