(
{
context: {isNot, promise},
hint,
inlineSnapshot,
matcherName,
properties,
}: MatchSnapshotConfig,
isUpdatable: boolean,
)
| 92 | export const PROPERTIES_ARG = 'properties'; |
| 93 | |
| 94 | export const matcherHintFromConfig = ( |
| 95 | { |
| 96 | context: {isNot, promise}, |
| 97 | hint, |
| 98 | inlineSnapshot, |
| 99 | matcherName, |
| 100 | properties, |
| 101 | }: MatchSnapshotConfig, |
| 102 | isUpdatable: boolean, |
| 103 | ): string => { |
| 104 | const options: MatcherHintOptions = {isNot, promise}; |
| 105 | if (isUpdatable) { |
| 106 | options.receivedColor = bReceivedColor; |
| 107 | } |
| 108 | |
| 109 | let expectedArgument = ''; |
| 110 | |
| 111 | if (typeof properties === 'object') { |
| 112 | expectedArgument = PROPERTIES_ARG; |
| 113 | if (isUpdatable) { |
| 114 | options.expectedColor = noColor; |
| 115 | } |
| 116 | |
| 117 | if (typeof hint === 'string' && hint.length > 0) { |
| 118 | options.secondArgument = HINT_ARG; |
| 119 | options.secondArgumentColor = BOLD_WEIGHT; |
| 120 | } else if (typeof inlineSnapshot === 'string') { |
| 121 | options.secondArgument = SNAPSHOT_ARG; |
| 122 | if (isUpdatable) { |
| 123 | options.secondArgumentColor = aSnapshotColor; |
| 124 | } else { |
| 125 | options.secondArgumentColor = noColor; |
| 126 | } |
| 127 | } |
| 128 | } else { |
| 129 | if (typeof hint === 'string' && hint.length > 0) { |
| 130 | expectedArgument = HINT_ARG; |
| 131 | options.expectedColor = BOLD_WEIGHT; |
| 132 | } else if (typeof inlineSnapshot === 'string') { |
| 133 | expectedArgument = SNAPSHOT_ARG; |
| 134 | if (isUpdatable) { |
| 135 | options.expectedColor = aSnapshotColor; |
| 136 | } |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | return matcherHint(matcherName, undefined, expectedArgument, options); |
| 141 | }; |
| 142 | |
| 143 | // Given array of diffs, return string: |
| 144 | // * include common substrings |
no test coverage detected