Skip to content

Commit

Permalink
Fix other package tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jassmith committed Nov 26, 2023
1 parent 8b2fedb commit ea0bcc0
Show file tree
Hide file tree
Showing 23 changed files with 117 additions and 229 deletions.
2 changes: 1 addition & 1 deletion packages/cells/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"scripts": {
"build": "./build.sh",
"lint": "eslint src --ext .ts,.tsx",
"test": "jest"
"test": "vitest"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/cells/src/cell.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { styled } from "@linaria/react";
import * as React from "react";
import { DataEditor, type DataEditorProps, GridCellKind } from "@glideapps/glide-data-grid";
import { DropdownCell as DropdownRenderer, useExtraCells } from ".";
import { DropdownCell as DropdownRenderer, useExtraCells } from "./index.js";
import type { StarCell } from "./cells/star-cell.js";
import type { SparklineCell } from "./cells/sparkline-cell.js";
import range from "lodash/range.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/cells/src/cells/article-cell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { ArticleCell } from "./article-cell-types.js";
import * as React from "react";
import { type CustomRenderer, getMiddleCenterBias, GridCellKind } from "@glideapps/glide-data-grid";

const ArticleCellEditor = React.lazy(async () => await import("./article-cell-editor"));
const ArticleCellEditor = React.lazy(async () => await import("./article-cell-editor.js"));

const renderer: CustomRenderer<ArticleCell> = {
kind: GridCellKind.Custom,
Expand Down
10 changes: 0 additions & 10 deletions packages/cells/src/setupTests.ts

This file was deleted.

2 changes: 0 additions & 2 deletions packages/cells/test/date-picker-cell.test.d.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/cells/test/date-picker-cell.test.d.ts.map

This file was deleted.

189 changes: 0 additions & 189 deletions packages/cells/test/date-picker-cell.test.js

This file was deleted.

1 change: 0 additions & 1 deletion packages/cells/test/date-picker-cell.test.js.map

This file was deleted.

10 changes: 7 additions & 3 deletions packages/cells/test/date-picker-cell.test.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import * as React from "react";
import { fireEvent, render } from "@testing-library/react";
import { fireEvent, render, cleanup } from "@testing-library/react";

import { GridCellKind } from "@glideapps/glide-data-grid";
import renderer, {
type DateKind,
type DatePickerCell,
formatValueForHTMLInput,
} from "../src/cells/date-picker-cell.js";
import { vi, expect, describe, it, afterEach } from "vitest";

describe("formatValueForHTMLInput", () => {
it.each([
["date", new Date("1970-01-01T00:00:00.100Z"), "1970-01-01"],
Expand All @@ -21,6 +23,8 @@ describe("formatValueForHTMLInput", () => {
});

describe("editor", () => {
afterEach(cleanup);

function getMockDateCell(props: Partial<DatePickerCell> = {}): DatePickerCell {
return {
...props,
Expand Down Expand Up @@ -125,7 +129,7 @@ describe("editor", () => {
throw new Error("Editor is invalid");
}

const mockCellOnChange = jest.fn();
const mockCellOnChange = vi.fn();
const result = render(<Editor isHighlighted={false} value={getMockDateCell()} onChange={mockCellOnChange} />);
const input = await result.findByTestId("date-picker-cell");
expect(result.findByTestId("date-picker-cell")).not.toBeUndefined();
Expand Down Expand Up @@ -157,7 +161,7 @@ describe("editor", () => {
throw new Error("Editor is invalid");
}

const mockCellOnChange = jest.fn();
const mockCellOnChange = vi.fn();
const result = render(<Editor isHighlighted={false} value={getMockDateCell()} onChange={mockCellOnChange} />);
const input = await result.findByTestId("date-picker-cell");
expect(result.findByTestId("date-picker-cell")).not.toBeUndefined();
Expand Down
2 changes: 0 additions & 2 deletions packages/cells/test/index.test.d.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/cells/test/index.test.d.ts.map

This file was deleted.

Loading

0 comments on commit ea0bcc0

Please sign in to comment.