@@ -649,6 +649,63 @@ func TestSupportsLinkable(t *testing.T) {
649
649
t .Fatalf ("Exepected value at '%s' to be a numeric (float64)" , k )
650
650
}
651
651
}
652
+
653
+ translation , hasTranslation := links ["frenchTranslation" ]
654
+ if ! hasTranslation {
655
+ t .Fatal ("expect 'frenchTranslation' to be present" )
656
+ }
657
+ translationMap , isMap := translation .(map [string ]interface {})
658
+ if ! isMap {
659
+ t .Fatal ("Expected 'frenchTranslation' to contain a map" )
660
+ }
661
+
662
+ alternateHref , hasHref := translationMap ["href" ]
663
+ if ! hasHref {
664
+ t .Fatal ("Expect 'alternate' to contain an 'href' key/value" )
665
+ }
666
+ if _ , isString := alternateHref .(string ); ! isString {
667
+ t .Fatal ("Expected 'href' to contain a string" )
668
+ }
669
+
670
+ alternateRel , hasRel := translationMap ["rel" ]
671
+ if ! hasRel {
672
+ t .Fatal ("Expect 'alternate' to contain an 'rel' key/value" )
673
+ }
674
+ if str , isString := alternateRel .(string ); ! isString {
675
+ t .Fatal ("Expected 'rel' to contain a string" )
676
+ } else if str != "alternate" {
677
+ t .Fatal ("Expected the 'rel' value to be 'alternate'" )
678
+ }
679
+
680
+ alternateTitle , hasTitle := translationMap ["title" ]
681
+ if ! hasTitle {
682
+ t .Fatal ("Expect 'alternate' to contain an 'title' key/value" )
683
+ }
684
+ if str , isString := alternateTitle .(string ); ! isString {
685
+ t .Fatal ("Expected 'title' to contain a string" )
686
+ } else if str != "Title 1" {
687
+ t .Fatal ("Expected the 'title' value to be 'Title 1'" )
688
+ }
689
+
690
+ alternateType , hasType := translationMap ["type" ]
691
+ if ! hasType {
692
+ t .Fatal ("Expect 'alternate' to contain an 'type' key/value" )
693
+ }
694
+ if str , isString := alternateType .(string ); ! isString {
695
+ t .Fatal ("Expected 'type' to contain a string" )
696
+ } else if str != "text/html" {
697
+ t .Fatal ("Expected the 'type' value to be 'text/html'" )
698
+ }
699
+
700
+ alternateHrefLang , hasHrefLang := translationMap ["hreflang" ]
701
+ if ! hasHrefLang {
702
+ t .Fatal ("Expect 'alternate' to contain an 'hreflang' key/value" )
703
+ }
704
+ if str , isString := alternateHrefLang .(string ); ! isString {
705
+ t .Fatal ("Expected 'hreflang' to contain a string" )
706
+ } else if str != "fr-fr" {
707
+ t .Fatal ("Expected the 'hreflang' value to be 'fr-fr'" )
708
+ }
652
709
}
653
710
654
711
func TestInvalidLinkable (t * testing.T ) {
0 commit comments