diff --git a/stringframebutton1target.go b/stringframebutton1target.go new file mode 100644 index 0000000..c0806aa --- /dev/null +++ b/stringframebutton1target.go @@ -0,0 +1,17 @@ +package frameproto + +// StringFrameButton1Target will return the HTML element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:button:1:target" name-value pair. +// +// For example, this call: +// +// var target string = "https://example.com/thing/do-it" +// +// str := frameproto.StringFrameButton1Target(target) +// +// Would return this HTML element: +// +// +func StringFrameButton1Target(target string) string { + const property string = MetaPropertyFrameButton1Target + return stringMetaPropertyContent(property, target) +} diff --git a/stringframebutton1target_test.go b/stringframebutton1target_test.go new file mode 100644 index 0000000..f74f0be --- /dev/null +++ b/stringframebutton1target_test.go @@ -0,0 +1,63 @@ +package frameproto + +import ( + "testing" +) + +func TestStringFrameButton1Target(t *testing.T) { + + tests := []struct{ + Target string + Expected string + }{ + { + Target: "", + Expected: ``+"\n", + }, + + + + { + Target: "something", + Expected: ``+"\n", + }, + + + + { + Target: "Hello world! 🙂", + Expected: ``+"\n", + }, + + + + { + Target: "https://example.com/path/to/post/to.php", + Expected: ``+"\n", + }, + + + + { + Target: "x-proto:apple/banana/cherry", + Expected: ``+"\n", + }, + } + + for testNumber, test := range tests { + + actual := StringFrameButton1Target(test.Target) + + expected := test.Expected + + if expected != actual { + t.Errorf("For test #%d, the actual written meta-tag is not what was expected." ,testNumber) + t.Logf("EXPECTED: %s", expected) + t.Logf("ACTUAL: %s", actual) + t.Logf("EXPECTED: %q", expected) + t.Logf("ACTUAL: %q", actual) + t.Logf("Target: %q", test.Target) + continue + } + } +} diff --git a/stringframebutton2target.go b/stringframebutton2target.go new file mode 100644 index 0000000..2cad518 --- /dev/null +++ b/stringframebutton2target.go @@ -0,0 +1,17 @@ +package frameproto + +// StringFrameButton2Target will return the HTML element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:button:2:target" name-value pair. +// +// For example, this call: +// +// var target string = "https://example.com/thing/do-it" +// +// str := frameproto.StringFrameButton2Target(target) +// +// Would return this HTML element: +// +// +func StringFrameButton2Target(target string) string { + const property string = MetaPropertyFrameButton2Target + return stringMetaPropertyContent(property, target) +} diff --git a/stringframebutton2target_test.go b/stringframebutton2target_test.go new file mode 100644 index 0000000..51dcff8 --- /dev/null +++ b/stringframebutton2target_test.go @@ -0,0 +1,63 @@ +package frameproto + +import ( + "testing" +) + +func TestStringFrameButton2Target(t *testing.T) { + + tests := []struct{ + Target string + Expected string + }{ + { + Target: "", + Expected: ``+"\n", + }, + + + + { + Target: "something", + Expected: ``+"\n", + }, + + + + { + Target: "Hello world! 🙂", + Expected: ``+"\n", + }, + + + + { + Target: "https://example.com/path/to/post/to.php", + Expected: ``+"\n", + }, + + + + { + Target: "x-proto:apple/banana/cherry", + Expected: ``+"\n", + }, + } + + for testNumber, test := range tests { + + actual := StringFrameButton2Target(test.Target) + + expected := test.Expected + + if expected != actual { + t.Errorf("For test #%d, the actual written meta-tag is not what was expected." ,testNumber) + t.Logf("EXPECTED: %s", expected) + t.Logf("ACTUAL: %s", actual) + t.Logf("EXPECTED: %q", expected) + t.Logf("ACTUAL: %q", actual) + t.Logf("Target: %q", test.Target) + continue + } + } +} diff --git a/stringframebutton3target.go b/stringframebutton3target.go new file mode 100644 index 0000000..ca36500 --- /dev/null +++ b/stringframebutton3target.go @@ -0,0 +1,17 @@ +package frameproto + +// StringFrameButton3Target will return the HTML element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:button:3:target" name-value pair. +// +// For example, this call: +// +// var target string = "https://example.com/thing/do-it" +// +// str := frameproto.StringFrameButton3Target(target) +// +// Would return this HTML element: +// +// +func StringFrameButton3Target(target string) string { + const property string = MetaPropertyFrameButton3Target + return stringMetaPropertyContent(property, target) +} diff --git a/stringframebutton3target_test.go b/stringframebutton3target_test.go new file mode 100644 index 0000000..504f470 --- /dev/null +++ b/stringframebutton3target_test.go @@ -0,0 +1,63 @@ +package frameproto + +import ( + "testing" +) + +func TestStringFrameButton3Target(t *testing.T) { + + tests := []struct{ + Target string + Expected string + }{ + { + Target: "", + Expected: ``+"\n", + }, + + + + { + Target: "something", + Expected: ``+"\n", + }, + + + + { + Target: "Hello world! 🙂", + Expected: ``+"\n", + }, + + + + { + Target: "https://example.com/path/to/post/to.php", + Expected: ``+"\n", + }, + + + + { + Target: "x-proto:apple/banana/cherry", + Expected: ``+"\n", + }, + } + + for testNumber, test := range tests { + + actual := StringFrameButton3Target(test.Target) + + expected := test.Expected + + if expected != actual { + t.Errorf("For test #%d, the actual written meta-tag is not what was expected." ,testNumber) + t.Logf("EXPECTED: %s", expected) + t.Logf("ACTUAL: %s", actual) + t.Logf("EXPECTED: %q", expected) + t.Logf("ACTUAL: %q", actual) + t.Logf("Target: %q", test.Target) + continue + } + } +} diff --git a/stringframebutton4target.go b/stringframebutton4target.go new file mode 100644 index 0000000..4ae6e54 --- /dev/null +++ b/stringframebutton4target.go @@ -0,0 +1,17 @@ +package frameproto + +// StringFrameButton4Target will return the HTML element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:button:4:target" name-value pair. +// +// For example, this call: +// +// var target string = "https://example.com/thing/do-it" +// +// str := frameproto.StringFrameButton4Target(target) +// +// Would return this HTML element: +// +// +func StringFrameButton4Target(target string) string { + const property string = MetaPropertyFrameButton4Target + return stringMetaPropertyContent(property, target) +} diff --git a/stringframebutton4target_test.go b/stringframebutton4target_test.go new file mode 100644 index 0000000..de6ff3c --- /dev/null +++ b/stringframebutton4target_test.go @@ -0,0 +1,63 @@ +package frameproto + +import ( + "testing" +) + +func TestStringFrameButton4Target(t *testing.T) { + + tests := []struct{ + Target string + Expected string + }{ + { + Target: "", + Expected: ``+"\n", + }, + + + + { + Target: "something", + Expected: ``+"\n", + }, + + + + { + Target: "Hello world! 🙂", + Expected: ``+"\n", + }, + + + + { + Target: "https://example.com/path/to/post/to.php", + Expected: ``+"\n", + }, + + + + { + Target: "x-proto:apple/banana/cherry", + Expected: ``+"\n", + }, + } + + for testNumber, test := range tests { + + actual := StringFrameButton4Target(test.Target) + + expected := test.Expected + + if expected != actual { + t.Errorf("For test #%d, the actual written meta-tag is not what was expected." ,testNumber) + t.Logf("EXPECTED: %s", expected) + t.Logf("ACTUAL: %s", actual) + t.Logf("EXPECTED: %q", expected) + t.Logf("ACTUAL: %q", actual) + t.Logf("Target: %q", test.Target) + continue + } + } +}