Common is no more a thing Use of TorrentParam instead of SearchParam now Common structs for search are exported in utils/search/structs Util has been renamed utils
36 lignes
880 o
Go
36 lignes
880 o
Go
package torrentLanguages
|
|
|
|
import (
|
|
"io/ioutil"
|
|
"path"
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/NyaaPantsu/nyaa/config"
|
|
)
|
|
|
|
// run before config/parse.go:init()
|
|
var _ = func() (_ struct{}) {
|
|
config.ConfigPath = path.Join("..", "..", config.ConfigPath)
|
|
config.DefaultConfigPath = path.Join("..", "..", config.DefaultConfigPath)
|
|
config.Parse()
|
|
return
|
|
}()
|
|
|
|
func TestCSSFlags(t *testing.T) {
|
|
languages := GetTorrentLanguages()
|
|
flagsCSSPath := path.Join("..", "..", "public", "css", "flags", "flags.css")
|
|
file, err := ioutil.ReadFile(flagsCSSPath)
|
|
if err != nil {
|
|
t.Errorf("Failed to load flags.css: %v", err)
|
|
return
|
|
}
|
|
|
|
contents := string(file)
|
|
for _, language := range languages {
|
|
flag := FlagFromLanguage(language)
|
|
if !strings.Contains(contents, ".flag-"+flag) {
|
|
t.Errorf("flags.css does not contains class .flag-%s. You probably need to update it.", flag)
|
|
}
|
|
}
|
|
}
|