Skip to content

Commit a5dbd5d

Browse files
authored
Update assertInlineSnapshot to support record mode (#947)
It still took a simple boolean, but should support things like `.failed`.
1 parent 2e6a85b commit a5dbd5d

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

Sources/InlineSnapshotTesting/AssertInlineSnapshot.swift

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import Foundation
3737
of value: @autoclosure () throws -> Value?,
3838
as snapshotting: Snapshotting<Value, String>,
3939
message: @autoclosure () -> String = "",
40-
record isRecording: Bool? = nil,
40+
record: SnapshotTestingConfiguration.Record? = nil,
4141
timeout: TimeInterval = 5,
4242
syntaxDescriptor: InlineSnapshotSyntaxDescriptor = InlineSnapshotSyntaxDescriptor(),
4343
matches expected: (() -> String)? = nil,
@@ -47,10 +47,7 @@ import Foundation
4747
line: UInt = #line,
4848
column: UInt = #column
4949
) {
50-
let record =
51-
(isRecording == true ? .all : isRecording == false ? .missing : nil)
52-
?? SnapshotTestingConfiguration.current?.record
53-
?? _record
50+
let record = record ?? SnapshotTestingConfiguration.current?.record ?? _record
5451
withSnapshotTesting(record: record) {
5552
let _: Void = installTestObserver
5653
do {

0 commit comments

Comments
 (0)