main
Raw Download raw file
 1package web
 2
 3import (
 4	"testing"
 5)
 6
 7func TestEmbeddedNoVNC(t *testing.T) {
 8	if !hasEmbeddedNoVNC() {
 9		t.Fatal("noVNC files should be embedded")
10	}
11
12	// Check that key files exist
13	files := []string{
14		"noVNC/vnc.html",
15		"noVNC/app/ui.js",
16		"noVNC/core/rfb.js",
17		"noVNC/vendor/pako/lib/zlib/inflate.js",
18	}
19
20	for _, path := range files {
21		data, err := embeddedNoVNC.ReadFile(path)
22		if err != nil {
23			t.Errorf("missing embedded file %s: %v", path, err)
24			continue
25		}
26		if len(data) == 0 {
27			t.Errorf("embedded file %s is empty", path)
28		}
29	}
30}
31
32func TestEmbeddedNoVNCDirectories(t *testing.T) {
33	// Verify directory structure
34	dirs := []string{
35		"noVNC",
36		"noVNC/app",
37		"noVNC/core",
38		"noVNC/vendor",
39	}
40
41	for _, dir := range dirs {
42		entries, err := embeddedNoVNC.ReadDir(dir)
43		if err != nil {
44			t.Errorf("cannot read directory %s: %v", dir, err)
45			continue
46		}
47		if len(entries) == 0 {
48			t.Errorf("directory %s is empty", dir)
49		}
50	}
51}