restore_test.go 800 B

123456789101112131415161718192021222324252627282930313233
  1. package sub_timeline_fixer
  2. import (
  3. "github.com/allanpk716/ChineseSubFinder/internal/pkg/unit_test_helper"
  4. "path/filepath"
  5. "testing"
  6. )
  7. func Test_searchBackUpSubFile(t *testing.T) {
  8. files, err := searchBackUpSubFile(unit_test_helper.GetTestDataResourceRootPath([]string{"sub_timeline_fixer", "org", "movies"}, 4, false))
  9. if err != nil {
  10. t.Fatal(err)
  11. }
  12. if len(files) != 3 {
  13. t.Fatal("backup files != 3")
  14. }
  15. }
  16. func TestRestore(t *testing.T) {
  17. rootDir := unit_test_helper.GetTestDataResourceRootPath([]string{"sub_timeline_fixer"}, 4, true)
  18. movieDir := filepath.Join(rootDir, "movies")
  19. seriesDir := filepath.Join(rootDir, "series")
  20. count, err := Restore([]string{movieDir}, []string{seriesDir})
  21. if err != nil {
  22. t.Fatal(err)
  23. }
  24. if count != 4 {
  25. t.Fatal("Restore files != 4")
  26. }
  27. }