github.com/go-kivik/kivik/v4@v4.3.2/x/kivikd/couchserver/couchserver_test.go (about) 1 // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 // use this file except in compliance with the License. You may obtain a copy of 3 // the License at 4 // 5 // http://www.apache.org/licenses/LICENSE-2.0 6 // 7 // Unless required by applicable law or agreed to in writing, software 8 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 // License for the specific language governing permissions and limitations under 11 // the License. 12 13 //go:build !js 14 15 package couchserver 16 17 import ( 18 "testing" 19 20 "github.com/go-kivik/kivik/v4" 21 ) 22 23 func TestVendor(t *testing.T) { 24 t.Run("Unset", func(t *testing.T) { 25 h := &Handler{} 26 c, v, vv := h.vendor() 27 if c != CompatVersion { 28 t.Errorf("CompatVer Expected: %s\n CompatVer Actual: %s", CompatVersion, c) 29 } 30 if want := "Kivik"; v != want { 31 t.Errorf("Vendor Expected: %s\n Vendor Actual: %s", want, v) 32 } 33 if vv != kivik.Version { 34 t.Errorf("Vendor Version Expected: %s\n Vendor Version Actual: %s", kivik.Version, vv) 35 } 36 }) 37 t.Run("Set", func(t *testing.T) { 38 ec, ev, evv := "123.Foo", "Test", "123.Bar" 39 h := &Handler{ 40 CompatVersion: ec, 41 Vendor: ev, 42 VendorVersion: evv, 43 } 44 c, v, vv := h.vendor() 45 if c != ec { 46 t.Errorf("CompatVer Expected: %s\n CompatVer Actual: %s", ec, c) 47 } 48 if v != ev { 49 t.Errorf("Vendor Expected: %s\n Vendor Actual: %s", ev, v) 50 } 51 if vv != evv { 52 t.Errorf("Vendor Version Expected: %s\n Vendor Version Actual: %s", evv, vv) 53 } 54 }) 55 }