<commit_before>package service

import (
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/ginkgo/extensions/table"
	. "github.com/onsi/gomega"

	"testing"
)

func TestByGinkgo(t *testing.T) {
	RegisterFailHandler(Fail)
	RunSpecs(t, "Service Suite")
}

var _ = Describe("[Unit] Test resolveUrl(...)", func() {
	DescribeTable("should panic when",
		func(host string, resource string) {
			Expect(
				func() {
					_ = resolveUrl(host, resource)
				},
			).To(Panic())
		},
		Entry("Empty host url", "", ""),
		Entry("Invalid scheme", "h@ttp://www.owl.com", "mysqlapi"),
	)

	DescribeTable("should parse successfully when",
		func(host, resource, expectedURL string) {
			url := resolveUrl(host, resource)
			Expect(url).To(Equal(expectedURL))
		},
		Entry("No tailing slash", "http://owl.com", "mysqlapi", "http://owl.com/mysqlapi"),
		Entry("1 tailing slash at host", "http://owl.com/", "mysqlapi", "http://owl.com/mysqlapi"),<commit_msg>[OWL-1621] Update scheme in a test case.<commit_after>package service

import (
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/ginkgo/extensions/table"
	. "github.com/onsi/gomega"

	"testing"
)

func TestByGinkgo(t *testing.T) {
	RegisterFailHandler(Fail)
	RunSpecs(t, "Service Suite")
}

var _ = Describe("[Unit] Test resolveUrl(...)", func() {
	DescribeTable("should panic when",
		func(host string, resource string) {
			Expect(
				func() {
					_ = resolveUrl(host, resource)
				},
			).To(Panic())
		},
		Entry("Empty host url", "", ""),
		Entry("Invalid scheme", "3h@ttp://www.owl.com", "mysqlapi"),
	)

	DescribeTable("should parse successfully when",
		func(host, resource, expectedURL string) {
			url := resolveUrl(host, resource)
			Expect(url).To(Equal(expectedURL))
		},
		Entry("No tailing slash", "http://owl.com", "mysqlapi", "http://owl.com/mysqlapi"),
		Entry("1 tailing slash at host", "http://owl.com/", "mysqlapi", "http://owl.com/mysqlapi"),
{'fraction_non_alphanumeric': 0.19117647058823528, 'fraction_numerical': 0.003676470588235294, 'mean_word_length': 4.190735694822888, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5983232', 'n_tokens_mistral': 742, 'n_tokens_neox': 676, 'n_words': 133}