(t *testing.T)
| 167 | } |
| 168 | |
| 169 | func firstEmbeddedAsset(t *testing.T) (string, []byte) { |
| 170 | t.Helper() |
| 171 | |
| 172 | staticFS := mustStaticFS(t) |
| 173 | entries, err := fs.ReadDir(staticFS, "assets") |
| 174 | if err != nil { |
| 175 | t.Fatalf("fs.ReadDir(assets) error = %v", err) |
| 176 | } |
| 177 | |
| 178 | for _, entry := range entries { |
| 179 | if entry.IsDir() { |
| 180 | continue |
| 181 | } |
| 182 | switch ext := path.Ext(entry.Name()); ext { |
| 183 | case ".js", ".css": |
| 184 | assetPath := path.Join("assets", entry.Name()) |
| 185 | data, readErr := fs.ReadFile(staticFS, assetPath) |
| 186 | if readErr != nil { |
| 187 | t.Fatalf("fs.ReadFile(%s) error = %v", assetPath, readErr) |
| 188 | } |
| 189 | return "/" + assetPath, data |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | t.Fatal("expected at least one embedded .js or .css asset") |
| 194 | return "", nil |
| 195 | } |
| 196 | |
| 197 | func writeLocalStaticDist(t *testing.T, indexMarker string, assets map[string]string) string { |
| 198 | t.Helper() |
no test coverage detected