Skip to content

Commit

Permalink
feat(row separator): Added row separator option (#372)
Browse files Browse the repository at this point in the history
  • Loading branch information
av-virlan committed Jun 12, 2021
1 parent 08878ec commit 63855ae
Show file tree
Hide file tree
Showing 9 changed files with 240 additions and 13 deletions.
16 changes: 16 additions & 0 deletions src/internalTable/internal-table-printer.ts
Expand Up @@ -175,6 +175,21 @@ const renderTableEnding = (table: TableInternal): string[] => {
return ret;
};

const renderRowSeparator = (table: TableInternal, row: Row): string[] => {
const ret: string[] = [];
let lastRowIndex = table.rows.length - 1;
let rowIndex = table.rows.indexOf(row);
let addSeparator = row.separator !== undefined ? row.separator : table.rowSeparator;

if (rowIndex > -1 && rowIndex < lastRowIndex && addSeparator) {
ret.push(renderTableHorizontalBorders(
table.tableStyle.rowSeparator,
table.columns.map((m) => m.length || DEFAULT_COLUMN_LEN)
));
}
return ret;
}

export const renderTable = (table: TableInternal): string => {
preProcessColumns(table); // enable / disable cols, find maxLn of each col/ computed Columns
preProcessRows(table); // sort and filter
Expand All @@ -186,6 +201,7 @@ export const renderTable = (table: TableInternal): string => {

table.rows.forEach((row) => {
renderRow(table, row).forEach((row_) => ret.push(row_));
renderRowSeparator(table, row).forEach((row_) => ret.push(row_));
});
renderTableEnding(table).forEach((row) => ret.push(row));
return ret.join('\n');
Expand Down
29 changes: 20 additions & 9 deletions src/internalTable/internal-table.ts
Expand Up @@ -10,6 +10,7 @@ import {
DEFAULT_TABLE_STYLE,
DEFAULT_ROW_ALIGNMENT,
DEFAULT_ROW_FONT_COLOR,
DEFAULT_ROW_SEPARATOR
} from '../utils/table-constants';
import {
createColumFromComputedColumn,
Expand Down Expand Up @@ -43,6 +44,8 @@ class TableInternal {

computedColumns: any[];

rowSeparator: boolean;

initSimple(columns: string[]) {
this.columns = columns.map((column) => ({
name: column,
Expand All @@ -52,14 +55,15 @@ class TableInternal {
}

initDetailed(options: ComplexOptions) {
this.title = options.title || undefined;
this.tableStyle = options?.style || DEFAULT_TABLE_STYLE;
this.sortFunction = options?.sort || DEFAULT_ROW_SORT_FUNC;
this.filterFunction = options?.filter || DEFAULT_ROW_FILTER_FUNC;
this.enabledColumns = options?.enabledColumns || [];
this.disabledColumns = options?.disabledColumns || [];
this.computedColumns = options?.computedColumns || [];
this.columns = options.columns?.map(rawColumnToInternalColumn) || [];
this.title = options?.title || this.title;
this.tableStyle = options?.style || this.tableStyle;
this.sortFunction = options?.sort || this.sortFunction;
this.filterFunction = options?.filter || this.filterFunction;
this.enabledColumns = options?.enabledColumns || this.enabledColumns;
this.disabledColumns = options?.disabledColumns || this.disabledColumns;
this.computedColumns = options?.computedColumns || this.computedColumns;
this.columns = options?.columns?.map(rawColumnToInternalColumn) || this.columns;
this.rowSeparator = options?.rowSeparator || this.rowSeparator;
}

constructor(options?: ComplexOptions | string[]) {
Expand All @@ -73,6 +77,7 @@ class TableInternal {
this.enabledColumns = [];
this.disabledColumns = [];
this.computedColumns = [];
this.rowSeparator = DEFAULT_ROW_SEPARATOR;

if (options instanceof Array) {
this.initSimple(options);
Expand Down Expand Up @@ -106,7 +111,13 @@ class TableInternal {

addRow(text: Dictionary, options?: RowOptions) {
this.createColumnFromRow(text);
this.rows.push(createRow(options?.color || DEFAULT_ROW_FONT_COLOR, text));
this.rows.push(
createRow(
options?.color || DEFAULT_ROW_FONT_COLOR,
text,
options?.separator
)
);
}

addRows(toBeInsertedRows: Dictionary[], options?: RowOptions) {
Expand Down
1 change: 1 addition & 0 deletions src/models/common.ts
Expand Up @@ -8,5 +8,6 @@ export interface Dictionary {
}
export interface Row {
color: COLOR;
separator?: boolean;
text: Dictionary;
}
1 change: 1 addition & 0 deletions src/models/external-table.ts
Expand Up @@ -29,4 +29,5 @@ export interface ComplexOptions {
enabledColumns?: string[];
disabledColumns?: string[];
computedColumns?: ComputedColumn[];
rowSeparator?: boolean;
}
1 change: 1 addition & 0 deletions src/models/internal-table.ts
Expand Up @@ -27,4 +27,5 @@ export type TableStyleDetails = {
headerBottom: TableLineDetails;
tableBottom: TableLineDetails;
vertical: string;
rowSeparator: TableLineDetails;
};
8 changes: 8 additions & 0 deletions src/utils/table-constants.ts
Expand Up @@ -3,6 +3,8 @@ import { TableStyleDetails } from '../models/internal-table';

export const DEFAULT_COLUMN_LEN = 20;

export const DEFAULT_ROW_SEPARATOR = false;

export const DEFAULT_TABLE_STYLE: TableStyleDetails = {
/*
Default Style
Expand Down Expand Up @@ -30,6 +32,12 @@ export const DEFAULT_TABLE_STYLE: TableStyleDetails = {
other: '─',
},
vertical: 'β”‚',
rowSeparator: {
left: 'β”œ',
mid: 'β”Ό',
right: '─',
other: '─',
},
};

export const ALIGNMENTS = ['right', 'left', 'center'];
Expand Down
20 changes: 16 additions & 4 deletions src/utils/table-helpers.ts
Expand Up @@ -4,7 +4,11 @@ import { ComputedColumn } from '../models/external-table';
import { Column } from '../models/internal-table';
import findWidthInConsole from './console-utils';
import { biggestWordInSentence, limitWidth } from './string-utils';
import { DEFAULT_COLUMN_LEN, DEFAULT_ROW_ALIGNMENT } from './table-constants';
import {
DEFAULT_COLUMN_LEN,
DEFAULT_ROW_ALIGNMENT,
DEFAULT_ROW_SEPARATOR,
} from './table-constants';

const max = (a: number, b: number) => Math.max(a, b);

Expand All @@ -13,11 +17,13 @@ export const cellText = (text: string | number): string =>
text === undefined || text === null ? '' : `${text}`;

export interface RowOptionsRaw {
color: string;
color?: string;
separator?: boolean;
}

export interface RowOptions {
color: COLOR;
separator: boolean;
}

export const convertRawRowOptionsToStandard = (
Expand All @@ -26,6 +32,7 @@ export const convertRawRowOptionsToStandard = (
if (options) {
return {
color: options.color as COLOR,
separator: options.separator || DEFAULT_ROW_SEPARATOR,
};
}
return undefined;
Expand Down Expand Up @@ -72,8 +79,13 @@ export const createColumFromComputedColumn = (
alignment: column.alignment || DEFAULT_ROW_ALIGNMENT,
});

export const createRow = (color: COLOR, text: Dictionary): Row => ({
export const createRow = (
color: COLOR,
text: Dictionary,
separator?: boolean
): Row => ({
color,
separator,
text,
});

Expand Down Expand Up @@ -116,7 +128,7 @@ export const renderTableHorizontalBorders = (

export const createHeaderAsRow = (createRowFn: any, columns: Column[]): Row => {
const headerColor: COLOR = 'white_bold';
const row: Row = createRowFn(headerColor, {});
const row: Row = createRowFn(headerColor, {}, false);
columns.forEach((column) => {
row.text[column.name] = column.title;
});
Expand Down
12 changes: 12 additions & 0 deletions test/internalTable/borderStyle.test.ts
Expand Up @@ -33,6 +33,12 @@ describe('Example: Check if borders are styled properly', () => {
other: '═',
},
vertical: 'β•‘',
rowSeparator: {
left: 'β•Ÿ',
mid: '╬',
right: 'β•’',
other: '═',
},
},
columns: [
{ name: 'index', alignment: 'left' },
Expand Down Expand Up @@ -101,6 +107,12 @@ describe('Example: Check if borders are styled properly', () => {
other: '\x1b[31m═\x1b[0m',
},
vertical: '\x1b[31mβ•‘\x1b[0m',
rowSeparator: {
left: '\x1b[31mβ•Ÿ\x1b[0m',
mid: '\x1b[31m╬\x1b[0m',
right: '\x1b[31mβ•’\x1b[0m',
other: '\x1b[31m═\x1b[0m',
},
},
columns: [
{ name: 'index', alignment: 'left' },
Expand Down
165 changes: 165 additions & 0 deletions test/internalTable/rowSeparator.test.ts
@@ -0,0 +1,165 @@
import { renderTable } from '../../src/internalTable/internal-table-printer';
import { Table } from '../../index';

describe('Testing Row separator', () => {
it('Batch Row separator by each row', () => {
// Create a table
const p = new Table();

p.addRow({ index: 3, text: 'row without separator', value: 100 });

p.addRow(
{ index: 4, text: 'row with separator', value: 300 },
{ separator: true }
);

p.addRow({ index: 5, text: 'row without separator', value: 100 });

// print
const returned = renderTable(p.table);

const expected = [
'β”Œβ”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”',
'\u001b[37mβ”‚\u001b[0m\u001b[37m \u001b[0m\u001b[01mindex\u001b[0m\u001b[37m β”‚\u001b[0m\u001b[37m \u001b[0m\u001b[01m text\u001b[0m\u001b[37m β”‚\u001b[0m\u001b[37m \u001b[0m\u001b[01mvalue\u001b[0m\u001b[37m β”‚\u001b[0m',
'β”œβ”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€',
'\u001b[37mβ”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37m 3\u001b[0m\u001b[37m β”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37mrow without separator\u001b[0m\u001b[37m β”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37m 100\u001b[0m\u001b[37m β”‚\u001b[0m',
'\u001b[37mβ”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37m 4\u001b[0m\u001b[37m β”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37m row with separator\u001b[0m\u001b[37m β”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37m 300\u001b[0m\u001b[37m β”‚\u001b[0m',
'β”œβ”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€',
'\u001b[37mβ”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37m 5\u001b[0m\u001b[37m β”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37mrow without separator\u001b[0m\u001b[37m β”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37m 100\u001b[0m\u001b[37m β”‚\u001b[0m',
'β””β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”˜',
];
expect(returned).toBe(expected.join('\n'));
});

it('Batch Row default separator is working', () => {
// Create a table
const p = new Table();

p.addRows([
// adding multiple rows are possible
{ index: 3, text: 'row default separator', value: 100 },
{ index: 4, text: 'row default separator', value: 300 },
]);

// print
const returned = renderTable(p.table);

const expected = [
'β”Œβ”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”',
'\u001b[37mβ”‚\u001b[0m\u001b[37m \u001b[0m\u001b[01mindex\u001b[0m\u001b[37m β”‚\u001b[0m\u001b[37m \u001b[0m\u001b[01m text\u001b[0m\u001b[37m β”‚\u001b[0m\u001b[37m \u001b[0m\u001b[01mvalue\u001b[0m\u001b[37m β”‚\u001b[0m',
'β”œβ”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€',
'\u001b[37mβ”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37m 3\u001b[0m\u001b[37m β”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37mrow default separator\u001b[0m\u001b[37m β”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37m 100\u001b[0m\u001b[37m β”‚\u001b[0m',
'\u001b[37mβ”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37m 4\u001b[0m\u001b[37m β”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37mrow default separator\u001b[0m\u001b[37m β”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37m 300\u001b[0m\u001b[37m β”‚\u001b[0m',
'β””β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”˜',
];
expect(returned).toBe(expected.join('\n'));
});

it('Batch Row table separator option is working', () => {
// Create a table
const p = new Table({ rowSeparator: true });

p.addRows([
// adding multiple rows are possible
{ index: 3, text: 'table row separator', value: 100 },
{ index: 4, text: 'table row separator', value: 300 },
]);

// print
const returned = renderTable(p.table);

const expected = [
'β”Œβ”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”',
'\u001b[37mβ”‚\u001b[0m\u001b[37m \u001b[0m\u001b[01mindex\u001b[0m\u001b[37m β”‚\u001b[0m\u001b[37m \u001b[0m\u001b[01m text\u001b[0m\u001b[37m β”‚\u001b[0m\u001b[37m \u001b[0m\u001b[01mvalue\u001b[0m\u001b[37m β”‚\u001b[0m',
'β”œβ”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€',
'\u001b[37mβ”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37m 3\u001b[0m\u001b[37m β”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37mtable row separator\u001b[0m\u001b[37m β”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37m 100\u001b[0m\u001b[37m β”‚\u001b[0m',
'β”œβ”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€',
'\u001b[37mβ”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37m 4\u001b[0m\u001b[37m β”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37mtable row separator\u001b[0m\u001b[37m β”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37m 300\u001b[0m\u001b[37m β”‚\u001b[0m',
'β””β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”˜',
];
expect(returned).toBe(expected.join('\n'));
});

it('Batch Row table separator override is working', () => {
// Create a table
const p = new Table({ rowSeparator: true });

p.addRows([
// adding multiple rows are possible
{ index: 3, text: 'override table row separator', value: 100 },
{ index: 4, text: 'override table row separator', value: 300 },
], { separator: false });

// print
const returned = renderTable(p.table);

const expected = [
'β”Œβ”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”',
'\u001b[37mβ”‚\u001b[0m\u001b[37m \u001b[0m\u001b[01mindex\u001b[0m\u001b[37m β”‚\u001b[0m\u001b[37m \u001b[0m\u001b[01m text\u001b[0m\u001b[37m β”‚\u001b[0m\u001b[37m \u001b[0m\u001b[01mvalue\u001b[0m\u001b[37m β”‚\u001b[0m',
'β”œβ”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€',
'\u001b[37mβ”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37m 3\u001b[0m\u001b[37m β”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37moverride table row separator\u001b[0m\u001b[37m β”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37m 100\u001b[0m\u001b[37m β”‚\u001b[0m',
'\u001b[37mβ”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37m 4\u001b[0m\u001b[37m β”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37moverride table row separator\u001b[0m\u001b[37m β”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37m 300\u001b[0m\u001b[37m β”‚\u001b[0m',
'β””β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”˜',
];
expect(returned).toBe(expected.join('\n'));
});

it('Batch Row separator is working', () => {
// Create a table
const p = new Table();

p.addRows(
[
// adding multiple rows are possible
{ index: 3, text: 'row with separator', value: 100 },
{ index: 4, text: 'row with separator', value: 300 },
],
{ separator: true }
);

// print
const returned = renderTable(p.table);

const expected = [
'β”Œβ”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”',
'\u001b[37mβ”‚\u001b[0m\u001b[37m \u001b[0m\u001b[01mindex\u001b[0m\u001b[37m β”‚\u001b[0m\u001b[37m \u001b[0m\u001b[01m text\u001b[0m\u001b[37m β”‚\u001b[0m\u001b[37m \u001b[0m\u001b[01mvalue\u001b[0m\u001b[37m β”‚\u001b[0m',
'β”œβ”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€',
'\u001b[37mβ”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37m 3\u001b[0m\u001b[37m β”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37mrow with separator\u001b[0m\u001b[37m β”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37m 100\u001b[0m\u001b[37m β”‚\u001b[0m',
'β”œβ”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€',
'\u001b[37mβ”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37m 4\u001b[0m\u001b[37m β”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37mrow with separator\u001b[0m\u001b[37m β”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37m 300\u001b[0m\u001b[37m β”‚\u001b[0m',
'β””β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”˜',
];
expect(returned).toBe(expected.join('\n'));
});

it('Batch Row separator combined with sorting', () => {
// Create a table and sort by index
const p = new Table({ sort: (row1, row2) => row1.index - row2.index, rowSeparator: true });

//Row with index 1 will have separator because it inherits from Table options
p.addRow({ index: 1, text: 'row inherit separator', value: 100 });
p.addRow({ index: 4, text: 'row without separator', value: 100 }, { separator: false });
//Row with index 5 will be last row so separator will be ignored anyway
p.addRow({ index: 5, text: 'row with separator', value: 100 }, { separator: true });
p.addRow({ index: 2, text: 'row with separator', value: 100 }, { separator: true });
p.addRow({ index: 3, text: 'row without separator', value: 100 }, { separator: false });

// print
const returned = renderTable(p.table);

const expected = [
'β”Œβ”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”',
'\u001b[37mβ”‚\u001b[0m\u001b[37m \u001b[0m\u001b[01mindex\u001b[0m\u001b[37m β”‚\u001b[0m\u001b[37m \u001b[0m\u001b[01m text\u001b[0m\u001b[37m β”‚\u001b[0m\u001b[37m \u001b[0m\u001b[01mvalue\u001b[0m\u001b[37m β”‚\u001b[0m',
'β”œβ”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€',
'\u001b[37mβ”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37m 1\u001b[0m\u001b[37m β”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37mrow inherit separator\u001b[0m\u001b[37m β”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37m 100\u001b[0m\u001b[37m β”‚\u001b[0m',
'β”œβ”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€',
'\u001b[37mβ”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37m 2\u001b[0m\u001b[37m β”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37m row with separator\u001b[0m\u001b[37m β”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37m 100\u001b[0m\u001b[37m β”‚\u001b[0m',
'β”œβ”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€',
'\u001b[37mβ”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37m 3\u001b[0m\u001b[37m β”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37mrow without separator\u001b[0m\u001b[37m β”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37m 100\u001b[0m\u001b[37m β”‚\u001b[0m',
'\u001b[37mβ”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37m 4\u001b[0m\u001b[37m β”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37mrow without separator\u001b[0m\u001b[37m β”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37m 100\u001b[0m\u001b[37m β”‚\u001b[0m',
'\u001b[37mβ”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37m 5\u001b[0m\u001b[37m β”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37m row with separator\u001b[0m\u001b[37m β”‚\u001b[0m\u001b[37m \u001b[0m\u001b[37m 100\u001b[0m\u001b[37m β”‚\u001b[0m',
'β””β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”˜',
];
expect(returned).toBe(expected.join('\n'));
});
});

0 comments on commit 63855ae

Please sign in to comment.