mirror of
https://github.com/Smaug123/WoofWare.Expect
synced 2025-10-05 12:38:39 +00:00
Multi snapshots (#8)
This commit is contained in:
48
WoofWare.Expect.Test/BulkUpdateExample.fs
Normal file
48
WoofWare.Expect.Test/BulkUpdateExample.fs
Normal 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
|
||||
}
|
@@ -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" />
|
||||
|
Reference in New Issue
Block a user