@@ -58,16 +58,6 @@ jest.mock("../../src/webrtc/call", () => ({
58
58
supportsMatrixCall : jest . fn ( ( ) => false ) ,
59
59
} ) ) ;
60
60
61
- enum AnsiColorCode {
62
- Red = 31 ,
63
- Green = 32 ,
64
- Yellow = 33 ,
65
- }
66
- // Add color to text in the terminal output
67
- function decorateStringWithAnsiColor ( inputString : string , decorationColor : AnsiColorCode ) : string {
68
- return `\x1b[${ decorationColor } m${ inputString } \x1b[0m` ;
69
- }
70
-
71
61
// Utility function to ease the transition from our QueryDict type to a string record
72
62
// which we can use to stringify with URLSearchParams
73
63
function convertQueryDictToStringRecord ( queryDict ?: QueryDict ) : Record < string , string > {
@@ -209,21 +199,15 @@ describe("MatrixClient", function() {
209
199
const receivedRequestQueryString = new URLSearchParams (
210
200
convertQueryDictToStringRecord ( queryParams ) ,
211
201
) . toString ( ) ;
212
- const receivedRequest = decorateStringWithAnsiColor (
213
- `${ method } ${ prefix } ${ path } ${ receivedRequestQueryString } ` ,
214
- AnsiColorCode . Red ,
215
- ) ;
202
+ const receivedRequestDebugString = `${ method } ${ prefix } ${ path } ${ receivedRequestQueryString } ` ;
216
203
const expectedQueryString = new URLSearchParams (
217
204
convertQueryDictToStringRecord ( next . expectQueryParams ) ,
218
205
) . toString ( ) ;
219
- const expectedRequest = decorateStringWithAnsiColor (
220
- `${ next . method } ${ next . prefix ?? '' } ${ next . path } ${ expectedQueryString } ` ,
221
- AnsiColorCode . Green ,
222
- ) ;
206
+ const expectedRequestDebugString = `${ next . method } ${ next . prefix ?? '' } ${ next . path } ${ expectedQueryString } ` ;
223
207
// If you're seeing this then you forgot to handle at least 1 pending request.
224
208
throw new Error (
225
- `A pending request was not handled: ${ receivedRequest } ` +
226
- `(next request expected was ${ expectedRequest } )\n` +
209
+ `A pending request was not handled: ${ receivedRequestDebugString } ` +
210
+ `(next request expected was ${ expectedRequestDebugString } )\n` +
227
211
`Check your tests to ensure your number of expectations lines up with your number of requests ` +
228
212
`made, and that those requests match your expectations.` ,
229
213
) ;
0 commit comments