MCPcopy Create free account
hub / github.com/auth0/auth0-cli / TestUnzip_Success

Function TestUnzip_Success

internal/utils/unzip_test.go:32–60  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

30}
31
32func TestUnzip_Success(t *testing.T) {
33 tmpDir := t.TempDir()
34 zipPath := filepath.Join(tmpDir, "test.zip")
35 destDir := filepath.Join(tmpDir, "out")
36
37 files := map[string]string{
38 "file1.txt": "hello",
39 "dir/file2.txt": "world",
40 "dir/sub/file3.txt": "nested",
41 }
42 createZip(t, zipPath, files)
43
44 err := Unzip(zipPath, destDir)
45 if err != nil {
46 t.Fatalf("Unzip failed: %v", err)
47 }
48
49 for name, content := range files {
50 fullPath := filepath.Join(destDir, name)
51 data, err := os.ReadFile(fullPath)
52 if err != nil {
53 t.Errorf("failed to read %s: %v", name, err)
54 continue
55 }
56 if string(data) != content {
57 t.Errorf("expected content %q in %s but got %q", content, name, string(data))
58 }
59 }
60}
61
62func TestUnzip_IllegalPath(t *testing.T) {
63 tmpDir := t.TempDir()

Callers

nothing calls this directly

Calls 3

createZipFunction · 0.85
UnzipFunction · 0.85
ErrorfMethod · 0.80

Tested by

no test coverage detected