Removed redundant test flag

This commit is contained in:
Rhys Williams 2024-12-10 13:41:31 +02:00
parent e5f73fa256
commit 34da1bf202
1 changed files with 20 additions and 27 deletions

View File

@ -23,37 +23,31 @@ func TestShouldRunQuickTunnel(t *testing.T) {
tests := []struct {
name string
flags map[string]string
expectQuickTunnel bool
expectError bool
}{
{
name: "Quick tunnel with URL set",
flags: map[string]string{"url": "http://127.0.0.1:8080", "quick-service": "https://fakeapi.trycloudflare.com"},
expectQuickTunnel: true,
expectError: false,
},
{
name: "Quick tunnel with unix-socket set",
flags: map[string]string{"unix-socket": "/tmp/socket", "quick-service": "https://fakeapi.trycloudflare.com"},
expectQuickTunnel: true,
expectError: false,
},
{
name: "Quick tunnel with hello-world flag",
flags: map[string]string{"hello-world": "true", "quick-service": "https://fakeapi.trycloudflare.com"},
expectQuickTunnel: true,
expectError: false,
},
{
name: "Quick tunnel with proxy-dns (invalid combo)",
flags: map[string]string{"url": "http://127.0.0.1:9090", "proxy-dns": "true", "quick-service": "https://fakeapi.trycloudflare.com"},
expectQuickTunnel: false,
expectError: true,
},
{
name: "No quick-service set",
flags: map[string]string{"url": "http://127.0.0.1:9090"},
expectQuickTunnel: false,
expectError: true,
},
}
@ -79,11 +73,10 @@ func TestShouldRunQuickTunnel(t *testing.T) {
// Validate
if tt.expectError {
assert.False(t, mockCalled)
require.Error(t, err)
} else if tt.expectQuickTunnel {
assert.True(t, mockCalled)
require.NoError(t, err)
} else {
assert.True(t, mockCalled)
require.NoError(t, err)
}
})