Multi snapshots (#8)

This commit is contained in:
Patrick Stevens
2025-06-16 17:45:35 +01:00
committed by GitHub
parent dbe9511793
commit 9c1960722a
11 changed files with 347 additions and 92 deletions

View File

@@ -0,0 +1,48 @@
namespace WoofWare.Expect.Test
open WoofWare.Expect
open NUnit.Framework
[<TestFixture>]
[<Parallelizable(ParallelScope.Children)>]
module BulkUpdateExample =
[<OneTimeSetUp>]
let ``Prepare to bulk-update tests`` () =
// Uncomment the `enterBulkUpdateMode` to cause all failing tests to accumulate their results
// into a global mutable collection.
// At the end of the test run, you should then call `updateAllSnapshots ()`
// to commit these accumulated failures to the source files.
//
// When in bulk update mode, all tests will fail, to remind you to exit bulk update mode afterwards.
//
// We *strongly* recommend making these test fixtures `[<Parallelizable(ParallelScope.Children)>]`
// or less parallelisable.
// GlobalBuilderConfig.enterBulkUpdateMode ()
()
[<OneTimeTearDown>]
let ``Update all tests`` () =
GlobalBuilderConfig.updateAllSnapshots ()
[<Test>]
let ``Snapshot 2`` () =
expect {
snapshotJson
@"{
""1"": ""hi"",
""2"": ""my"",
""3"": ""name"",
""4"": ""is""
}"
return Map.ofList [ "1", "hi" ; "2", "my" ; "3", "name" ; "4", "is" ]
}
[<Test>]
let ``Snapshot 1`` () =
expect {
snapshotJson @"123"
return 123
}

View File

@@ -8,6 +8,7 @@
<ItemGroup>
<Compile Include="Assembly.fs" />
<Compile Include="BulkUpdateExample.fs" />
<Compile Include="SimpleTest.fs" />
<Compile Include="TestSnapshotFinding.fs" />
<Compile Include="TestSurface.fs" />