dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

templates_test.go (614B)


      1 package template
      2 
      3 import "testing"
      4 
      5 func Test_buildTemplateName(t *testing.T) {
      6 	type args struct {
      7 		prefix string
      8 		page   string
      9 	}
     10 	tests := []struct {
     11 		name string
     12 		args args
     13 		want string
     14 	}{
     15 		{"", args{prefix: "/", page: "page"}, "page"},
     16 		{"", args{prefix: "/admin", page: "page"}, "admin.page"},
     17 		{"", args{prefix: "/admin/settings", page: "page"}, "admin.settings.page"},
     18 	}
     19 	for _, tt := range tests {
     20 		t.Run(tt.name, func(t *testing.T) {
     21 			if got := buildTemplateName(tt.args.prefix, tt.args.page); got != tt.want {
     22 				t.Errorf("buildTemplateName() = %v, want %v", got, tt.want)
     23 			}
     24 		})
     25 	}
     26 }