Skip to content

Commit

Permalink
extend scripted test for snapshot promote filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
majk-p committed Sep 18, 2024
1 parent 409331b commit 7aca7f9
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package simple

import weaver.*
import snapshot4s.weaver.SnapshotExpectations
import snapshot4s.generated.snapshotConfig

object OtherTest extends SimpleIOSuite with SnapshotExpectations {

test("inline") {
assertInlineSnapshot(123, 456)
}

test("new inline snapshot") {
assertInlineSnapshot(1, ???)
}

test("file that doesn't exist") {
assertFileSnapshot("other-contents", "nonexistent-file")
}

test("existing file") {
assertFileSnapshot("contents", "existing-file")
}

test("file in nested directory") {
assertFileSnapshot("contents", "nested-directory/nested-file")
}

}
19 changes: 11 additions & 8 deletions modules/plugin/src/sbt-test/sbt-snapshot4s/promote-filter/test
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@
-> ++ 2.13 test
-> ++ 3 test
# Not update anything with invalid filter
# > snapshot4sPromote *IDontExist*
# # Tests should fail as snapshots are out of date
# -> ++ 2.12 test
# -> ++ 2.13 test
# -> ++ 3 test
> snapshot4sPromote *IDontExist*
# Tests should fail as snapshots are out of date
-> ++ 2.12 test
-> ++ 2.13 test
-> ++ 3 test
# # Update snapshots with correct filter
> snapshot4sPromote *FilterTest*
# # Tests should succeed with updated snapshots
> ++ 2.12 test
> ++ 2.13 test
> ++ 3 test
> ++ 2.12 testOnly *FilterTest*
> ++ 2.13 testOnly *FilterTest*
> ++ 3 testOnly *FilterTest*
-> ++ 2.12 testOnly *OtherTest*
-> ++ 2.13 testOnly *OtherTest*
-> ++ 3 testOnly *OtherTest*

0 comments on commit 7aca7f9

Please sign in to comment.