1
0

mirror_test.go 686 B

123456789101112131415161718192021222324252627282930313233
  1. package database
  2. import (
  3. "testing"
  4. "github.com/stretchr/testify/assert"
  5. )
  6. func Test_parseRemoteUpdateOutput(t *testing.T) {
  7. tests := []struct {
  8. output string
  9. expResults []*mirrorSyncResult
  10. }{
  11. {
  12. `
  13. From https://try.gogs.io/unknwon/upsteam
  14. * [new branch] develop -> develop
  15. b0bb24f..1d85a4f master -> master
  16. - [deleted] (none) -> bugfix
  17. `,
  18. []*mirrorSyncResult{
  19. {"develop", gitShortEmptyID, ""},
  20. {"master", "b0bb24f", "1d85a4f"},
  21. {"bugfix", "", gitShortEmptyID},
  22. },
  23. },
  24. }
  25. for _, test := range tests {
  26. t.Run("", func(t *testing.T) {
  27. assert.Equal(t, test.expResults, parseRemoteUpdateOutput(test.output))
  28. })
  29. }
  30. }