|
| 1 | +import _ from 'lodash'; |
1 | 2 | import React, { useState, useEffect } from 'react'; |
2 | 3 | import sinon from 'sinon'; |
3 | 4 | import { render, screen, waitFor, configure } from '@testing-library/react'; |
@@ -39,6 +40,12 @@ function filterEvaluateCalls(calls: any) { |
39 | 40 |
|
40 | 41 | let lastKey = 0; |
41 | 42 |
|
| 43 | +function stripKeys(output: ShellOutputEntry[]) { |
| 44 | + return output.map((entry) => { |
| 45 | + return _.omit(entry, ['key']); |
| 46 | + }); |
| 47 | +} |
| 48 | + |
42 | 49 | describe('shell', function () { |
43 | 50 | let fakeRuntime; |
44 | 51 | let scrollIntoView; |
@@ -107,7 +114,7 @@ describe('shell', function () { |
107 | 114 | ); |
108 | 115 |
|
109 | 116 | await waitFor(() => { |
110 | | - expect(output).to.deep.equal([ |
| 117 | + expect(stripKeys(output)).to.deep.equal([ |
111 | 118 | { |
112 | 119 | format: 'input', |
113 | 120 | value: 'my command', |
@@ -264,7 +271,7 @@ describe('shell', function () { |
264 | 271 | ); |
265 | 272 |
|
266 | 273 | await waitFor(() => { |
267 | | - expect(output).to.deep.equal([ |
| 274 | + expect(stripKeys(output)).to.deep.equal([ |
268 | 275 | { |
269 | 276 | format: 'input', |
270 | 277 | value: ' ', |
@@ -295,7 +302,7 @@ describe('shell', function () { |
295 | 302 | ); |
296 | 303 |
|
297 | 304 | await waitFor(() => { |
298 | | - expect(output).to.deep.equal([ |
| 305 | + expect(stripKeys(output)).to.deep.equal([ |
299 | 306 | { |
300 | 307 | format: 'input', |
301 | 308 | value: 'my command', |
@@ -336,7 +343,7 @@ describe('shell', function () { |
336 | 343 | ); |
337 | 344 |
|
338 | 345 | await waitFor(() => { |
339 | | - expect(output).to.deep.equal([ |
| 346 | + expect(stripKeys(output)).to.deep.equal([ |
340 | 347 | { |
341 | 348 | format: 'output', |
342 | 349 | type: undefined, |
@@ -408,14 +415,14 @@ describe('shell', function () { |
408 | 415 | ); |
409 | 416 |
|
410 | 417 | await waitFor(() => { |
411 | | - expect(output[output.length - 1]).to.deep.equal({ |
| 418 | + expect(stripKeys(output)[output.length - 1]).to.deep.equal({ |
412 | 419 | format: 'output', |
413 | 420 | type: undefined, |
414 | 421 | value: 'some result', |
415 | 422 | }); |
416 | 423 | }); |
417 | 424 |
|
418 | | - expect(output).to.deep.equal([ |
| 425 | + expect(stripKeys(output)).to.deep.equal([ |
419 | 426 | // we typed "my command" |
420 | 427 | { format: 'input', value: 'my command' }, |
421 | 428 | // while evaluating it printed something |
|
0 commit comments