Skip to content

Commit 0eae9d8

Browse files
committed
fix tests
1 parent 2632deb commit 0eae9d8

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

packages/browser-repl/src/components/shell.spec.tsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import _ from 'lodash';
12
import React, { useState, useEffect } from 'react';
23
import sinon from 'sinon';
34
import { render, screen, waitFor, configure } from '@testing-library/react';
@@ -39,6 +40,12 @@ function filterEvaluateCalls(calls: any) {
3940

4041
let lastKey = 0;
4142

43+
function stripKeys(output: ShellOutputEntry[]) {
44+
return output.map((entry) => {
45+
return _.omit(entry, ['key']);
46+
});
47+
}
48+
4249
describe('shell', function () {
4350
let fakeRuntime;
4451
let scrollIntoView;
@@ -107,7 +114,7 @@ describe('shell', function () {
107114
);
108115

109116
await waitFor(() => {
110-
expect(output).to.deep.equal([
117+
expect(stripKeys(output)).to.deep.equal([
111118
{
112119
format: 'input',
113120
value: 'my command',
@@ -264,7 +271,7 @@ describe('shell', function () {
264271
);
265272

266273
await waitFor(() => {
267-
expect(output).to.deep.equal([
274+
expect(stripKeys(output)).to.deep.equal([
268275
{
269276
format: 'input',
270277
value: ' ',
@@ -295,7 +302,7 @@ describe('shell', function () {
295302
);
296303

297304
await waitFor(() => {
298-
expect(output).to.deep.equal([
305+
expect(stripKeys(output)).to.deep.equal([
299306
{
300307
format: 'input',
301308
value: 'my command',
@@ -336,7 +343,7 @@ describe('shell', function () {
336343
);
337344

338345
await waitFor(() => {
339-
expect(output).to.deep.equal([
346+
expect(stripKeys(output)).to.deep.equal([
340347
{
341348
format: 'output',
342349
type: undefined,
@@ -408,14 +415,14 @@ describe('shell', function () {
408415
);
409416

410417
await waitFor(() => {
411-
expect(output[output.length - 1]).to.deep.equal({
418+
expect(stripKeys(output)[output.length - 1]).to.deep.equal({
412419
format: 'output',
413420
type: undefined,
414421
value: 'some result',
415422
});
416423
});
417424

418-
expect(output).to.deep.equal([
425+
expect(stripKeys(output)).to.deep.equal([
419426
// we typed "my command"
420427
{ format: 'input', value: 'my command' },
421428
// while evaluating it printed something

0 commit comments

Comments
 (0)