From 53588cd6c9cce0941628facfbf82fec495a14ad6 Mon Sep 17 00:00:00 2001 From: David Kang Date: Tue, 15 Oct 2024 18:35:43 -0700 Subject: [PATCH] Fix test cases to account for new sorted order --- cmd/lekko/sync_test.go | 2 +- cmd/lekko/testdata/gertrude.go | 14 +++++++------- cmd/lekko/testdata/withcontext.go | 24 ++++++++++++------------ 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/cmd/lekko/sync_test.go b/cmd/lekko/sync_test.go index 0b7e7686..b3a591c9 100644 --- a/cmd/lekko/sync_test.go +++ b/cmd/lekko/sync_test.go @@ -185,7 +185,7 @@ func TestGoSyncToGenToSync(t *testing.T) { if err != nil { t.Fatalf("diff: %v", err) } - t.Fatalf("mismatch in generated code: %s", diff) + t.Fatalf("mismatch in generated code:\n%s", diff) } s2 := sync.NewGoSyncer() diff --git a/cmd/lekko/testdata/gertrude.go b/cmd/lekko/testdata/gertrude.go index c00de07e..d2f85a78 100644 --- a/cmd/lekko/testdata/gertrude.go +++ b/cmd/lekko/testdata/gertrude.go @@ -5,17 +5,17 @@ type Widget struct { Size float64 } -func getWidget() *Widget { - return &Widget{ - Name: "Terry", - Size: getSize(), - } +func getDirect() float64 { + return getSize() } func getSize() float64 { return 43.1 } -func getDirect() float64 { - return getSize() +func getWidget() *Widget { + return &Widget{ + Name: "Terry", + Size: getSize(), + } } diff --git a/cmd/lekko/testdata/withcontext.go b/cmd/lekko/testdata/withcontext.go index 6d732fe0..469e5f3c 100644 --- a/cmd/lekko/testdata/withcontext.go +++ b/cmd/lekko/testdata/withcontext.go @@ -4,18 +4,6 @@ type BlockedDomains struct { Domains []string } -type DefaultEditorModeArgs struct { - Username string -} - -// Default editor mode -func getDefaultEditorMode(args *DefaultEditorModeArgs) string { - if args.Username == "non-engineer@lekko.com" { - return "visual" - } - return "code" -} - // Blocked auto-join domains func getBlockedAutoJoinDomains() *BlockedDomains { return &BlockedDomains{ @@ -30,3 +18,15 @@ func getBlockedAutoJoinDomains() *BlockedDomains { }, } } + +type DefaultEditorModeArgs struct { + Username string +} + +// Default editor mode +func getDefaultEditorMode(args *DefaultEditorModeArgs) string { + if args.Username == "non-engineer@lekko.com" { + return "visual" + } + return "code" +}