Skip to content

Commit

Permalink
Minor changes for render testing
Browse files Browse the repository at this point in the history
  • Loading branch information
waybackarchiver committed May 1, 2022
1 parent 567017e commit c8878d6
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 8 deletions.
13 changes: 13 additions & 0 deletions reduxer/example.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

package reduxer // import "github.com/wabarc/wayback/reduxer"

import (
"github.com/go-shiori/go-readability"
"github.com/wabarc/screenshot"
)

func BundleExample() Reduxer {
rdx := NewReduxer()
bnd := &bundle{
Expand Down Expand Up @@ -58,6 +63,14 @@ func BundleExample() Reduxer {
},
},
},
shots: &screenshot.Screenshots{
Title: "Example",
},
article: readability.Article{
TextContent: `This domain is for use in illustrative examples in documents. You may use this domain in literature without prior coordination or asking for permission.
More information...`,
},
}

rdx.Store(Src("https://example.com/"), bnd)
Expand Down
16 changes: 14 additions & 2 deletions template/render/discord_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ import (
)

func TestRenderDiscord(t *testing.T) {
message := `Internet Archive:
message := `**Example**
This domain is for use in illustrative examples in documents. You may use this domain in literature without prior coordination or asking for permission.
More information...
Internet Archive:
• https://web.archive.org/web/20211000000001/https://example.com/
archive.today:
Expand All @@ -28,7 +34,13 @@ Telegraph:
}

func TestRenderDiscordFlawed(t *testing.T) {
message := `Internet Archive:
message := `**Example**
This domain is for use in illustrative examples in documents. You may use this domain in literature without prior coordination or asking for permission.
More information...
Internet Archive:
• Get "https://web.archive.org/save/https://example.com": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
archive.today:
Expand Down
6 changes: 5 additions & 1 deletion template/render/github_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ func TestRenderGitHubFlawed(t *testing.T) {
}

func TestRenderGitHubWithArtifact(t *testing.T) {
const expected = `**[Internet Archive](https://web.archive.org/)**:
const expected = `This domain is for use in illustrative examples in documents. You may use this domain in literature without prior coordination or asking for permission.
More information...
**[Internet Archive](https://web.archive.org/)**:
> source: [https://example.com/](https://example.com/)
> archived: [https://web.archive.org/web/20211000000001/https://example.com/](https://web.archive.org/web/20211000000001/https://example.com/)
Expand Down
8 changes: 6 additions & 2 deletions template/render/matrix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import (
)

func TestRenderMatrix(t *testing.T) {
const matExp = `<b><a href='https://web.archive.org/'>Internet Archive</a></b>:<br>
const matExp = `‹ <b>Example</b> ›<br><br>This domain is for use in illustrative examples in documents. You may use this domain in literature without prior coordination or asking for permission.
More information...<br><br><b><a href='https://web.archive.org/'>Internet Archive</a></b>:<br>
• <a href="https://example.com/">source</a> - https://web.archive.org/web/20211000000001/https://example.com/<br>
<br>
<b><a href='https://archive.today/'>archive.today</a></b>:<br>
Expand All @@ -31,7 +33,9 @@ func TestRenderMatrix(t *testing.T) {
}

func TestRenderMatrixWithArtifact(t *testing.T) {
const matExp = `<b><a href='https://web.archive.org/'>Internet Archive</a></b>:<br>
const matExp = `‹ <b>Example</b> ›<br><br>This domain is for use in illustrative examples in documents. You may use this domain in literature without prior coordination or asking for permission.
More information...<br><br><b><a href='https://web.archive.org/'>Internet Archive</a></b>:<br>
• <a href="https://example.com/">source</a> - https://web.archive.org/web/20211000000001/https://example.com/<br>
<br>
<b><a href='https://archive.today/'>archive.today</a></b>:<br>
Expand Down
8 changes: 7 additions & 1 deletion template/render/slack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ import (
)

func TestRenderSlack(t *testing.T) {
message := `Internet Archive:
message := `‹ Example ›
This domain is for use in illustrative examples in documents. You may use this domain in literature without prior coordination or asking for permission.
More information...
Internet Archive:
• https://web.archive.org/web/20211000000001/https://example.com/
archive.today:
Expand Down
9 changes: 8 additions & 1 deletion template/render/telegram_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@ import (
"testing"
)

var message = `<b><a href="https://web.archive.org/">Internet Archive</a></b>:
var message = `<b>Example</b>
This domain is for use in illustrative examples in documents. You may use this domain in literature without prior coordination or asking for permission.
More information...
<b><a href="https://web.archive.org/">Internet Archive</a></b>:
• <a href="https://example.com/">source</a> - <a href="https://web.archive.org/web/20211000000001/https://example.com/">https://web.archive.org/web/20211000000001/https://example.com/</a>
<b><a href="https://archive.today/">archive.today</a></b>:
Expand Down
4 changes: 3 additions & 1 deletion template/render/twitter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import (
)

func TestRenderTwitter(t *testing.T) {
const tweet = `source:
const tweet = `‹ Example ›
source:
• https://example.com/
————
Expand Down

0 comments on commit c8878d6

Please sign in to comment.