diff options
Diffstat (limited to 'spec/frontend/__helpers__/matchers/to_match_interpolated_text.js')
-rw-r--r-- | spec/frontend/__helpers__/matchers/to_match_interpolated_text.js | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/spec/frontend/__helpers__/matchers/to_match_interpolated_text.js b/spec/frontend/__helpers__/matchers/to_match_interpolated_text.js index 4ce814a01b4..41e69bffd88 100644 --- a/spec/frontend/__helpers__/matchers/to_match_interpolated_text.js +++ b/spec/frontend/__helpers__/matchers/to_match_interpolated_text.js @@ -1,4 +1,5 @@ -export const toMatchInterpolatedText = (received, match) => { +// Custom matchers are object methods and should be traditional functions to be able to access `utils` on `this` +export function toMatchInterpolatedText(received, match) { let clearReceived; let clearMatch; @@ -15,16 +16,14 @@ export const toMatchInterpolatedText = (received, match) => { const pass = clearReceived === clearMatch; const message = pass ? () => ` - \n\n - Expected: ${this.utils.printExpected(clearReceived)} - To not equal: ${this.utils.printReceived(clearMatch)} + Expected to not be: ${this.utils.printExpected(clearMatch)} + Received: ${this.utils.printReceived(clearReceived)} ` : () => ` - \n\n - Expected: ${this.utils.printExpected(clearReceived)} - To equal: ${this.utils.printReceived(clearMatch)} + Expected to be: ${this.utils.printExpected(clearMatch)} + Received: ${this.utils.printReceived(clearReceived)} `; return { actual: received, message, pass }; -}; +} |