package validate_test

import (
	"testing"

	"github.com/stretchr/testify/assert"
	"penahub.gitlab.yandexcloud.net/pena-services/customer/pkg/validate"
)

func TestValidateURL(t *testing.T) {
	assert.True(t, validate.URL("http://google.com"))
	assert.True(t, validate.URL("http://w.com/cn"))
	assert.True(t, validate.URL("http://192.158.0.1:90"))
	assert.False(t, validate.URL("192.158.0.1:9090"))
	assert.False(t, validate.URL("http://w"))
	assert.False(t, validate.URL("fsw"))
	assert.True(t, validate.URL("http://192.158.1/1"))
	assert.True(t, validate.URL("https://www.googleapis.com/oauth2/v3"))
	assert.True(t, validate.URL("http://localhost:8080/google/callback"))
	assert.True(t, validate.URL("https://oauth.pena.digital/amocrm/callback"))
	assert.True(t, validate.URL("https://www.amocrm.ru/oauth"))
	assert.True(t, validate.URL("https://www.amocrm.ru/oauth/access_token"))
	assert.True(t, validate.URL("http://localhost:8080/vk/callback"))
	assert.True(t, validate.URL("http://mock:8000/api/v4/account"))
}
