<commit_before>package main

import (
	"testing"
)

func TestCheckHostInWhiteListWithEmptyConfiguration(t *testing.T) {
	config := new(Configuration)
	validator := Validator{config}

	if err := validator.CheckHostInWhiteList("doesnt exists"); err == nil {
		t.Errorf("Missing error returning!")
	}
}

func TestCheckHostInWhiteListWithSomeHostsInWhieList(t *testing.T) {
	config := new(Configuration)
	config.HostWhiteList = []string{"http://www.google.com", "two hosts"}
	validator := Validator{config}

	// Check for one that doesn't exists
	err := validator.CheckHostInWhiteList("http://www.sergiosola.com/")
	if err == nil {
		t.Errorf("Should return an error!!!")
	}
}

func TestCheckHostInWhiteListWithValidHost(t *testing.T) {
	config := new(Configuration)
	config.HostWhiteList = []string{"one host", "sergiosola.com"}
	validator := Validator{config}

	err := validator.CheckHostInWhiteList("https://sergiosola.com/images?withParams=dsada")
	if err != nil {
		t.Errorf("Should not to return an error!!!")
	}
}

func TestCheckHostInWhiteListWithValidPattern(t *testing.T) {
	config := new(Configuration)
	config.HostWhiteList = []string{"www.google.com", "([a-z]+).cdn.google.com"}
	validator := Validator{config}<commit_msg>rename tests<commit_after>package main

import (
	"testing"
)

func Test_CheckHostInWhiteListWithEmptyConfiguration(t *testing.T) {
	config := new(Configuration)
	validator := Validator{config}

	if err := validator.CheckHostInWhiteList("doesnt exists"); err == nil {
		t.Errorf("Missing error returning!")
	}
}

func Test_CheckHostInWhiteListWithSomeHostsInWhieList(t *testing.T) {
	config := new(Configuration)
	config.HostWhiteList = []string{"http://www.google.com", "two hosts"}
	validator := Validator{config}

	// Check for one that doesn't exists
	err := validator.CheckHostInWhiteList("http://www.sergiosola.com/")
	if err == nil {
		t.Errorf("Should return an error!!!")
	}
}

func Test_CheckHostInWhiteListWithValidHost(t *testing.T) {
	config := new(Configuration)
	config.HostWhiteList = []string{"one host", "sergiosola.com"}
	validator := Validator{config}

	err := validator.CheckHostInWhiteList("https://sergiosola.com/images?withParams=dsada")
	if err != nil {
		t.Errorf("Should not to return an error!!!")
	}
}

func Test_CheckHostInWhiteListWithValidPattern(t *testing.T) {
	config := new(Configuration)
	config.HostWhiteList = []string{"www.google.com", "([a-z]+).cdn.google.com"}
	validator := Validator{config}
{'fraction_non_alphanumeric': 0.14929006085192698, 'fraction_numerical': 0.0, 'mean_word_length': 5.8121546961325965, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1634166', 'n_tokens_mistral': 826, 'n_tokens_neox': 821, 'n_words': 156}