github.com/ericwq/aprilsh@v0.0.0-20240517091432-958bc568daa0/frontend/client/integration_test.go (about) 1 // Copyright 2022~2023 wangqi. All rights reserved. 2 // Use of this source code is governed by a MIT-style 3 // license that can be found in the LICENSE file. 4 5 //go:build integration 6 7 package main 8 9 // https://go.dev/blog/integration-test-coverage 10 func TestFetchKey(t *testing.T) { 11 tc := []struct { 12 label string 13 conf *Config 14 pwd string 15 expect string 16 }{ 17 {"normal response", &Config{user: "ide", host: "localhost", port: 60000}, "password", ""}, 18 } 19 for _, v := range tc { 20 t.Run(v.label, func(t *testing.T) { 21 got := v.conf.fetchKey(v.pwd) 22 if got != v.expect { 23 t.Errorf("#test %q expect %q, got %q\n", v.label, v.expect, got) 24 } 25 }) 26 } 27 }