Skip to content

Commit 7e6cb30

Browse files
author
Tobias Meinhardt
committed
Test for push method
1 parent 57a3840 commit 7e6cb30

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

git/native_adapter_test.go

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,38 @@ func TestCommit(t *testing.T) {
167167
local.Do("touch test.file")
168168

169169
s.AddAll()
170-
s.Commit("Commit test.file")
170+
_, _, err := s.Commit("Commit test.file")
171+
if err != nil {
172+
t.Error(err)
173+
}
171174

172-
stdout, _, err := local.Do(`git status | grep "%s"`, branchIsAhead)
175+
stdout, _, _ := local.Do(`git status | grep "%s"`, branchIsAhead)
173176
if stdout.String() == "" {
174177
t.Errorf("Branch should be 1 commit ahead")
175178
}
179+
}
180+
181+
func TestPushU(t *testing.T) {
182+
local, _, teardown := testenv.SetupEnv(t)
183+
defer teardown()
184+
185+
branchIsUpToDate := "Your branch is up to date with 'origin/master'"
186+
s := setupNativeGitService(local.Folder)
187+
local.Do("touch test.file")
188+
s.AddAll()
189+
s.Commit("Commit test.file")
190+
stdout, _, _ := local.Do(`git status | grep "%s"`, branchIsUpToDate)
191+
if stdout.String() != "" {
192+
t.Error("Branch should NOT be up to date")
193+
}
194+
195+
_, _, err := s.Push(false)
176196
if err != nil {
177-
t.Errorf(err.Error())
197+
t.Error(err)
198+
}
199+
200+
stdout, _, _ = local.Do(`git status | grep "%s"`, branchIsUpToDate)
201+
if stdout.String() == "" {
202+
t.Error("Branch should be up to date")
178203
}
179204
}

0 commit comments

Comments
 (0)