Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import type { EventSummaryModel, StackSummaryModel, SummaryTemplateKeys } from '$features/events/components/summary';

import { describe, expect, it } from 'vitest';

import { getColumns } from './options.svelte';

describe('getColumns', () => {
it('keeps stack events, first, and last columns sortable', () => {
const result = getColumns<StackSummaryModel<SummaryTemplateKeys>>('stack_frequent');
const columnsById = Object.fromEntries(result.map((column) => [column.id, column]));

expect(columnsById.events?.enableSorting).toBeUndefined();
expect(columnsById.first?.enableSorting).toBeUndefined();
expect(columnsById.last?.enableSorting).toBeUndefined();
});

it('keeps summary message column unsortable', () => {
const result = getColumns<EventSummaryModel<SummaryTemplateKeys>>('summary');
const columnsById = Object.fromEntries(result.map((column) => [column.id, column]));

expect(columnsById.message?.enableSorting).toBe(false);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ export function getColumns<TSummaryModel extends SummaryModel<SummaryTemplateKey
{
accessorKey: nameof<StackSummaryModel<SummaryTemplateKeys>>('total'),
cell: (prop) => renderComponent(NumberFormatter, { value: prop.getValue<number>() }),
enableSorting: false,
header: 'Events',
id: 'events',
meta: {
Expand All @@ -164,7 +163,6 @@ export function getColumns<TSummaryModel extends SummaryModel<SummaryTemplateKey
{
accessorKey: nameof<StackSummaryModel<SummaryTemplateKeys>>('first_occurrence'),
cell: (prop) => renderComponent(TimeAgo, { value: prop.getValue<string>() }),
enableSorting: false,
header: 'First',
id: 'first',
meta: {
Expand All @@ -174,7 +172,6 @@ export function getColumns<TSummaryModel extends SummaryModel<SummaryTemplateKey
{
accessorKey: nameof<StackSummaryModel<SummaryTemplateKeys>>('last_occurrence'),
cell: (prop) => renderComponent(TimeAgo, { value: prop.getValue<string>() }),
enableSorting: false,
header: 'Last',
id: 'last',
meta: {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { describe, expect, it } from 'vitest';

import { getSessionColumns } from './session-table-columns';

describe('getSessionColumns', () => {
it('keeps duration column sortable', () => {
const result = getSessionColumns();
const columnsById = Object.fromEntries(result.map((column) => [column.id, column]));

expect(columnsById.duration?.enableSorting).toBeUndefined();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ export function getSessionColumns(): ColumnDef<StockFeatures, EventSummaryModel<
},
{
cell: (prop) => renderComponent(SessionDurationCell, { summary: prop.row.original }),
enableSorting: false,
header: 'Duration',
id: 'duration',
meta: {
Expand Down