From df260c2288755e6a9d43761d1721d947cd77f104 Mon Sep 17 00:00:00 2001 From: Carlosokumu Date: Fri, 20 Sep 2024 22:42:02 +0300 Subject: [PATCH] add expected navigation paths for single edit --- internal/utils/navigationmatcher.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 internal/utils/navigationmatcher.go diff --git a/internal/utils/navigationmatcher.go b/internal/utils/navigationmatcher.go new file mode 100644 index 0000000..a403abf --- /dev/null +++ b/internal/utils/navigationmatcher.go @@ -0,0 +1,24 @@ +package utils + +func MatchNavigationPath(a, b []string) bool { + + if len(a) != len(b) { + return false + } + //Check if the navigation path matches with single edit + for i := range a { + if a[i] != b[i] { + return false + } + } + + return true +} + +func GetSingleEditExecutionPath(key string) []string { + paths := make(map[string][]string) + paths["select_gender"] = []string{"root", "main", "my_account", "edit_profile", "select_gender"} + paths["save_location"] = []string{"root", "main", "my_account", "edit_profile", "enter_location"} + paths["save_yob"] = []string{"root", "main", "my_account", "edit_profile", "enter_yob"} + return paths[key] +}