initial commits
							parent
							
								
									66ab70ee0b
								
							
						
					
					
						commit
						26047f706d
					
				| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
package frameproto
 | 
			
		||||
 | 
			
		||||
// StringFrameButton1Target will return the HTML <meta/> 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 <meta/> element:
 | 
			
		||||
//
 | 
			
		||||
//	<meta property="fc:frame:button:1:target" content="https://example.com/thing/do-it" />
 | 
			
		||||
func StringFrameButton1Target(target string) string {
 | 
			
		||||
	const property string = MetaPropertyFrameButton1Target
 | 
			
		||||
	return stringMetaPropertyContent(property, target)
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,63 @@
 | 
			
		|||
package frameproto
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"testing"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func TestStringFrameButton1Target(t *testing.T) {
 | 
			
		||||
 | 
			
		||||
	tests := []struct{
 | 
			
		||||
		Target string
 | 
			
		||||
		Expected string
 | 
			
		||||
	}{
 | 
			
		||||
		{
 | 
			
		||||
			Target: "",
 | 
			
		||||
			Expected: `<meta property="fc:frame:button:1:target" content="" />`+"\n",
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		{
 | 
			
		||||
			Target: "something",
 | 
			
		||||
			Expected: `<meta property="fc:frame:button:1:target" content="something" />`+"\n",
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		{
 | 
			
		||||
			Target: "Hello world! 🙂",
 | 
			
		||||
			Expected: `<meta property="fc:frame:button:1:target" content="Hello world! 🙂" />`+"\n",
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		{
 | 
			
		||||
			Target: "https://example.com/path/to/post/to.php",
 | 
			
		||||
			Expected: `<meta property="fc:frame:button:1:target" content="https://example.com/path/to/post/to.php" />`+"\n",
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		{
 | 
			
		||||
			Target: "x-proto:apple/banana/cherry",
 | 
			
		||||
			Expected: `<meta property="fc:frame:button:1:target" content="x-proto:apple/banana/cherry" />`+"\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
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
package frameproto
 | 
			
		||||
 | 
			
		||||
// StringFrameButton2Target will return the HTML <meta/> 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 <meta/> element:
 | 
			
		||||
//
 | 
			
		||||
//	<meta property="fc:frame:button:2:target" content="https://example.com/thing/do-it" />
 | 
			
		||||
func StringFrameButton2Target(target string) string {
 | 
			
		||||
	const property string = MetaPropertyFrameButton2Target
 | 
			
		||||
	return stringMetaPropertyContent(property, target)
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,63 @@
 | 
			
		|||
package frameproto
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"testing"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func TestStringFrameButton2Target(t *testing.T) {
 | 
			
		||||
 | 
			
		||||
	tests := []struct{
 | 
			
		||||
		Target string
 | 
			
		||||
		Expected string
 | 
			
		||||
	}{
 | 
			
		||||
		{
 | 
			
		||||
			Target: "",
 | 
			
		||||
			Expected: `<meta property="fc:frame:button:2:target" content="" />`+"\n",
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		{
 | 
			
		||||
			Target: "something",
 | 
			
		||||
			Expected: `<meta property="fc:frame:button:2:target" content="something" />`+"\n",
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		{
 | 
			
		||||
			Target: "Hello world! 🙂",
 | 
			
		||||
			Expected: `<meta property="fc:frame:button:2:target" content="Hello world! 🙂" />`+"\n",
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		{
 | 
			
		||||
			Target: "https://example.com/path/to/post/to.php",
 | 
			
		||||
			Expected: `<meta property="fc:frame:button:2:target" content="https://example.com/path/to/post/to.php" />`+"\n",
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		{
 | 
			
		||||
			Target: "x-proto:apple/banana/cherry",
 | 
			
		||||
			Expected: `<meta property="fc:frame:button:2:target" content="x-proto:apple/banana/cherry" />`+"\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
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
package frameproto
 | 
			
		||||
 | 
			
		||||
// StringFrameButton3Target will return the HTML <meta/> 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 <meta/> element:
 | 
			
		||||
//
 | 
			
		||||
//	<meta property="fc:frame:button:3:target" content="https://example.com/thing/do-it" />
 | 
			
		||||
func StringFrameButton3Target(target string) string {
 | 
			
		||||
	const property string = MetaPropertyFrameButton3Target
 | 
			
		||||
	return stringMetaPropertyContent(property, target)
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,63 @@
 | 
			
		|||
package frameproto
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"testing"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func TestStringFrameButton3Target(t *testing.T) {
 | 
			
		||||
 | 
			
		||||
	tests := []struct{
 | 
			
		||||
		Target string
 | 
			
		||||
		Expected string
 | 
			
		||||
	}{
 | 
			
		||||
		{
 | 
			
		||||
			Target: "",
 | 
			
		||||
			Expected: `<meta property="fc:frame:button:3:target" content="" />`+"\n",
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		{
 | 
			
		||||
			Target: "something",
 | 
			
		||||
			Expected: `<meta property="fc:frame:button:3:target" content="something" />`+"\n",
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		{
 | 
			
		||||
			Target: "Hello world! 🙂",
 | 
			
		||||
			Expected: `<meta property="fc:frame:button:3:target" content="Hello world! 🙂" />`+"\n",
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		{
 | 
			
		||||
			Target: "https://example.com/path/to/post/to.php",
 | 
			
		||||
			Expected: `<meta property="fc:frame:button:3:target" content="https://example.com/path/to/post/to.php" />`+"\n",
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		{
 | 
			
		||||
			Target: "x-proto:apple/banana/cherry",
 | 
			
		||||
			Expected: `<meta property="fc:frame:button:3:target" content="x-proto:apple/banana/cherry" />`+"\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
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
package frameproto
 | 
			
		||||
 | 
			
		||||
// StringFrameButton4Target will return the HTML <meta/> 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 <meta/> element:
 | 
			
		||||
//
 | 
			
		||||
//	<meta property="fc:frame:button:4:target" content="https://example.com/thing/do-it" />
 | 
			
		||||
func StringFrameButton4Target(target string) string {
 | 
			
		||||
	const property string = MetaPropertyFrameButton4Target
 | 
			
		||||
	return stringMetaPropertyContent(property, target)
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,63 @@
 | 
			
		|||
package frameproto
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"testing"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func TestStringFrameButton4Target(t *testing.T) {
 | 
			
		||||
 | 
			
		||||
	tests := []struct{
 | 
			
		||||
		Target string
 | 
			
		||||
		Expected string
 | 
			
		||||
	}{
 | 
			
		||||
		{
 | 
			
		||||
			Target: "",
 | 
			
		||||
			Expected: `<meta property="fc:frame:button:4:target" content="" />`+"\n",
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		{
 | 
			
		||||
			Target: "something",
 | 
			
		||||
			Expected: `<meta property="fc:frame:button:4:target" content="something" />`+"\n",
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		{
 | 
			
		||||
			Target: "Hello world! 🙂",
 | 
			
		||||
			Expected: `<meta property="fc:frame:button:4:target" content="Hello world! 🙂" />`+"\n",
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		{
 | 
			
		||||
			Target: "https://example.com/path/to/post/to.php",
 | 
			
		||||
			Expected: `<meta property="fc:frame:button:4:target" content="https://example.com/path/to/post/to.php" />`+"\n",
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		{
 | 
			
		||||
			Target: "x-proto:apple/banana/cherry",
 | 
			
		||||
			Expected: `<meta property="fc:frame:button:4:target" content="x-proto:apple/banana/cherry" />`+"\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
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
		Reference in New Issue