initial commits

master
Charles Iliya Krempeaux 2024-02-14 16:29:57 -08:00
parent 2b24feddab
commit 4f79731e90
2 changed files with 12 additions and 12 deletions

View File

@ -15,7 +15,7 @@ package frameproto
// Would append this HTML <meta/> element: // Would append this HTML <meta/> element:
// //
// <meta property="fc:frame:input:text" content="enter your username" /> // <meta property="fc:frame:input:text" content="enter your username" />
func AppendFrameInputText(p []byte, url string) []byte { func AppendFrameInputText(p []byte, label string) []byte {
const property string = MetaPropertyFrameInputText const property string = MetaPropertyFrameInputText
return appendMetaPropertyContent(p, property, url) return appendMetaPropertyContent(p, property, label)
} }

View File

@ -7,39 +7,39 @@ import (
func TestAppendFrameInputText(t *testing.T) { func TestAppendFrameInputText(t *testing.T) {
tests := []struct{ tests := []struct{
Version string Label string
Expected string Expected string
}{ }{
{ {
Version: "", Label: "",
Expected: `<meta property="fc:frame:input:text" content="" />`+"\n", Expected: `<meta property="fc:frame:input:text" content="" />`+"\n",
}, },
{ {
Version: "something", Label: "something",
Expected: `<meta property="fc:frame:input:text" content="something" />`+"\n", Expected: `<meta property="fc:frame:input:text" content="something" />`+"\n",
}, },
{ {
Version: "Hello world! 🙂", Label: "Hello world! 🙂",
Expected: `<meta property="fc:frame:input:text" content="Hello world! 🙂" />`+"\n", Expected: `<meta property="fc:frame:input:text" content="Hello world! 🙂" />`+"\n",
}, },
{ {
Version: "enter your username", Label: "enter your username",
Expected: `<meta property="fc:frame:input:text" content="enter your username" />`+"\n", Expected: `<meta property="fc:frame:input:text" content="enter your username" />`+"\n",
}, },
{ {
Version: "I like to eat, eat, eat, apples and banana", Label: "I like to eat, eat, eat, apples and banana",
Expected: `<meta property="fc:frame:input:text" content="I like to eat, eat, eat, apples and banana" />`+"\n", Expected: `<meta property="fc:frame:input:text" content="I like to eat, eat, eat, apples and banana" />`+"\n",
}, },
} }
@ -50,7 +50,7 @@ func TestAppendFrameInputText(t *testing.T) {
var buffer [256]byte var buffer [256]byte
var p []byte = buffer[0:0] var p []byte = buffer[0:0]
p = AppendFrameInputText(p, test.Version) p = AppendFrameInputText(p, test.Label)
expected := test.Expected expected := test.Expected
actual := string(p) actual := string(p)
@ -61,7 +61,7 @@ func TestAppendFrameInputText(t *testing.T) {
t.Logf("ACTUAL: %s", actual) t.Logf("ACTUAL: %s", actual)
t.Logf("EXPECTED: %q", expected) t.Logf("EXPECTED: %q", expected)
t.Logf("ACTUAL: %q", actual) t.Logf("ACTUAL: %q", actual)
t.Logf("LABEL: %q", test.Version) t.Logf("LABEL: %q", test.Label)
continue continue
} }
} }
@ -75,7 +75,7 @@ func TestAppendFrameInputText(t *testing.T) {
p = append(p, top...) p = append(p, top...)
p = AppendFrameInputText(p, test.Version) p = AppendFrameInputText(p, test.Label)
p = append(p, bottom...) p = append(p, bottom...)
@ -88,7 +88,7 @@ func TestAppendFrameInputText(t *testing.T) {
t.Logf("ACTUAL: %s", actual) t.Logf("ACTUAL: %s", actual)
t.Logf("EXPECTED: %q", expected) t.Logf("EXPECTED: %q", expected)
t.Logf("ACTUAL: %q", actual) t.Logf("ACTUAL: %q", actual)
t.Logf("LABEL: %q", test.Version) t.Logf("LABEL: %q", test.Label)
continue continue
} }
} }