Skip to content

Commit 0884405

Browse files
committed
Actually test changes
1 parent cfd5610 commit 0884405

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

patrol/patrol_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212

1313
"github.com/go-git/go-git/v5"
1414
"github.com/go-git/go-git/v5/plumbing/object"
15+
"github.com/stretchr/testify/assert"
1516
"github.com/stretchr/testify/require"
1617
"github.com/utilitywarehouse/patrol/patrol"
1718
)
@@ -72,8 +73,12 @@ func (test *RepoTest) Run(t *testing.T) {
7273
require.NoError(t, err)
7374
}
7475

75-
_, err = patrol.NewRepo(tmp)
76+
r, err := patrol.NewRepo(tmp)
7677
require.NoError(t, err)
78+
79+
changes, err := r.ChangesFrom(test.TestAgainstRevision)
80+
require.NoError(t, err)
81+
assert.Equal(t, test.ExpectedChangedPackages, changes)
7782
}
7883

7984
type RepoTests []RepoTest

patrol/repo_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@ func TestRepo(t *testing.T) {
99
Name: "change within module",
1010
Description: "A change to a package within the same module\n" +
1111
"should flag depending packages as changed",
12-
TestAgainstRevision: "HEAD~1",
13-
ExpectedChangedPackages: []string{},
12+
TestAgainstRevision: "HEAD~1",
13+
ExpectedChangedPackages: []string{
14+
"github.com/utilitywarehouse/internalchange/internal/bar",
15+
"github.com/utilitywarehouse/internalchange/internal/foo",
16+
},
1417
},
1518
}
1619

0 commit comments

Comments
 (0)