Skip to content

Commit

Permalink
Fix mapColumn test
Browse files Browse the repository at this point in the history
  • Loading branch information
wylieconlon committed Jun 28, 2021
1 parent 79b0bdf commit bf3c1ab
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import { Datatable } from '../../../expression_types';
import { mapColumn, MapColumnArguments } from '../map_column';
import { emptyTable, functionWrapper, testTable, tableWithNulls } from './utils';

const pricePlusTwo = (datatable: Datatable) => of(datatable.rows[0].price + 2);
const pricePlusTwo = (datatable: Datatable) =>
of(typeof datatable.rows[0].price === 'number' ? datatable.rows[0].price + 2 : null);

describe('mapColumn', () => {
const fn = functionWrapper(mapColumn);
Expand Down Expand Up @@ -223,7 +224,7 @@ describe('mapColumn', () => {
testScheduler.run(({ expectObservable }) => {
expectObservable(
runFn(
{ ...emptyTable, rows: [...emptyTable.rows, { value: 5 }] },
{ ...emptyTable, rows: [...emptyTable.rows, { price: 5 }] },
{ name: 'value', copyMetaFrom: 'time', expression: pricePlusTwo }
)
).toBe('(0|)', [
Expand All @@ -236,6 +237,7 @@ describe('mapColumn', () => {
meta: expect.objectContaining({ type: 'number' }),
}),
],
rows: [{ price: 5, value: 7 }],
}),
]);
});
Expand All @@ -248,7 +250,6 @@ describe('mapColumn', () => {
id: 'value',
name: 'value',
expression: pricePlusTwo,
onError: 'null',
})
).toBe('(0|)', [
expect.objectContaining({
Expand Down

0 comments on commit bf3c1ab

Please sign in to comment.