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