-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support matchStandaloneSnapshot (#102)
- Loading branch information
1 parent
91ca918
commit 2fadb85
Showing
18 changed files
with
766 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
examples/__snapshots__/TestMatchStandaloneSnapshot_should_create_html_snapshots_1.snap.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
<!DOCTYPE html> | ||
<html> | ||
<body> | ||
|
||
<h1>My First Heading</h1> | ||
|
||
<p>My first paragraph.</p> | ||
|
||
</body> | ||
</html> |
1 change: 1 addition & 0 deletions
1
examples/__snapshots__/TestMatchStandaloneSnapshot_should_create_html_snapshots_2.snap.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<div>Hello World</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
hello world-0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
hello world-1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
hello world-2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
hello world-3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package examples | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/gkampitakis/go-snaps/snaps" | ||
) | ||
|
||
func TestMatchStandaloneSnapshot(t *testing.T) { | ||
t.Run("should create html snapshots", func(t *testing.T) { | ||
snaps := snaps.WithConfig( | ||
snaps.Ext(".html"), | ||
) | ||
|
||
snaps.MatchStandaloneSnapshot(t, ` | ||
<!DOCTYPE html> | ||
<html> | ||
<body> | ||
<h1>My First Heading</h1> | ||
<p>My first paragraph.</p> | ||
</body> | ||
</html> | ||
`) | ||
snaps.MatchStandaloneSnapshot(t, "<div>Hello World</div>") | ||
}) | ||
|
||
t.Run("should create standalone snapshots with specified filename", func(t *testing.T) { | ||
snaps := snaps.WithConfig( | ||
snaps.Filename("my_standalone_snap"), | ||
) | ||
|
||
snaps.MatchStandaloneSnapshot(t, "hello world-0") | ||
snaps.MatchStandaloneSnapshot(t, "hello world-1") | ||
snaps.MatchStandaloneSnapshot(t, "hello world-2") | ||
snaps.MatchStandaloneSnapshot(t, "hello world-3") | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.