Skip to content

Commit

Permalink
Use jest@30 alpha (#783)
Browse files Browse the repository at this point in the history
  • Loading branch information
emmatown authored Nov 27, 2023
1 parent f5a8b86 commit bb1bc84
Show file tree
Hide file tree
Showing 17 changed files with 557 additions and 464 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ module.exports = {
'jest/valid-title': OFF,
'jest/no-try-expect': OFF,
'jest/no-disabled-tests': ERROR,
'jest/no-alias-methods': ERROR,
'jsx-quotes': ERROR,
'no-trailing-spaces': ERROR,
'no-undef': ERROR,
Expand Down
2 changes: 1 addition & 1 deletion design-system/pkg/src/button/test/Button.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('button/Button', () => {

await userEvent.click(button);

expect(onPress).toBeCalledTimes(1);
expect(onPress).toHaveBeenCalledTimes(1);
});
});

Expand Down
2 changes: 1 addition & 1 deletion design-system/pkg/src/link/test/TextLink.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,6 @@ describe('navigation/TextLink', () => {

fireEvent.click(getByRole('link'));

expect(onPress).toBeCalledTimes(1);
expect(onPress).toHaveBeenCalledTimes(1);
});
});
24 changes: 12 additions & 12 deletions design-system/pkg/src/listbox/test/ListBox.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ describe('pickers/ListBox', () => {
let checkmarks = tree.getAllByRole('img', { hidden: true });
expect(checkmarks.length).toBe(1);

expect(onSelectionChange).toBeCalledTimes(1);
expect(onSelectionChange).toHaveBeenCalledTimes(1);
expect(onSelectionChange.mock.calls[0][0].has('Bleh')).toBeTruthy();
});

Expand Down Expand Up @@ -220,7 +220,7 @@ describe('pickers/ListBox', () => {
let checkmarks = tree.getAllByRole('img', { hidden: true });
expect(checkmarks.length).toBe(1);

expect(onSelectionChange).toBeCalledTimes(1);
expect(onSelectionChange).toHaveBeenCalledTimes(1);
expect(onSelectionChange.mock.calls[0][0].has('Bleh')).toBeTruthy();
});

Expand All @@ -244,7 +244,7 @@ describe('pickers/ListBox', () => {
expect(checkmarks.length).toBe(1);

// Verify onSelectionChange is called
expect(onSelectionChange).toBeCalledTimes(1);
expect(onSelectionChange).toHaveBeenCalledTimes(1);
expect(onSelectionChange.mock.calls[0][0].has('Bleh')).toBeTruthy();
});

Expand All @@ -268,7 +268,7 @@ describe('pickers/ListBox', () => {
expect(checkmarks.length).toBe(1);

// Verify onSelectionChange is called
expect(onSelectionChange).toBeCalledTimes(1);
expect(onSelectionChange).toHaveBeenCalledTimes(1);
expect(onSelectionChange.mock.calls[0][0].has('Bleh')).toBeTruthy();
});

Expand Down Expand Up @@ -321,7 +321,7 @@ describe('pickers/ListBox', () => {
checkmarks = tree.getAllByRole('img', { hidden: true });
expect(checkmarks.length).toBe(2);

expect(onSelectionChange).toBeCalledTimes(2);
expect(onSelectionChange).toHaveBeenCalledTimes(2);
expect(onSelectionChange.mock.calls[0][0].has('Blah')).toBeTruthy();
expect(onSelectionChange.mock.calls[1][0].has('Bar')).toBeTruthy();
});
Expand Down Expand Up @@ -365,7 +365,7 @@ describe('pickers/ListBox', () => {
checkmarks = tree.getAllByRole('img', { hidden: true });
expect(checkmarks.length).toBe(3);

expect(onSelectionChange).toBeCalledTimes(1);
expect(onSelectionChange).toHaveBeenCalledTimes(1);
expect(onSelectionChange.mock.calls[0][0].has('Bleh')).toBeTruthy();
expect(onSelectionChange.mock.calls[0][0].has('Foo')).toBeTruthy();
expect(onSelectionChange.mock.calls[0][0].has('Bar')).toBeTruthy();
Expand Down Expand Up @@ -412,7 +412,7 @@ describe('pickers/ListBox', () => {
checkmarks = tree.getAllByRole('img', { hidden: true });
expect(checkmarks.length).toBe(2);

expect(onSelectionChange).toBeCalledTimes(1);
expect(onSelectionChange).toHaveBeenCalledTimes(1);
expect(onSelectionChange.mock.calls[0][0].has('Bleh')).toBeTruthy();
});

Expand Down Expand Up @@ -456,7 +456,7 @@ describe('pickers/ListBox', () => {
checkmarks = tree.getAllByRole('img', { hidden: true });
expect(checkmarks.length).toBe(1);

expect(onSelectionChange).toBeCalledTimes(1);
expect(onSelectionChange).toHaveBeenCalledTimes(1);
expect(onSelectionChange.mock.calls[0][0].has('Bar')).toBeTruthy();
});

Expand All @@ -482,7 +482,7 @@ describe('pickers/ListBox', () => {
let checkmarks = tree.getAllByRole('img', { hidden: true });
expect(checkmarks.length).toBe(2);

expect(onSelectionChange).toBeCalledTimes(0);
expect(onSelectionChange).toHaveBeenCalledTimes(0);
});
});

Expand Down Expand Up @@ -510,7 +510,7 @@ describe('pickers/ListBox', () => {
// Make sure nothing is still checked
checkmarks = tree.queryAllByRole('img');
expect(checkmarks.length).toBe(0);
expect(onSelectionChange).toBeCalledTimes(0);
expect(onSelectionChange).toHaveBeenCalledTimes(0);
});
});

Expand Down Expand Up @@ -598,7 +598,7 @@ describe('pickers/ListBox', () => {
expect(checkmarks.length).toBe(0);

// Verify onSelectionChange was not called
expect(onSelectionChange).toBeCalledTimes(0);
expect(onSelectionChange).toHaveBeenCalledTimes(0);

// Continue the search
fireEvent.keyDown(listbox, { key: 'B' });
Expand Down Expand Up @@ -630,7 +630,7 @@ describe('pickers/ListBox', () => {
expect(checkmarks.length).toBe(1);

// Verify onSelectionChange is called
expect(onSelectionChange).toBeCalledTimes(1);
expect(onSelectionChange).toHaveBeenCalledTimes(1);
expect(onSelectionChange.mock.calls[0][0].has('Foo Bar')).toBeTruthy();
});

Expand Down
22 changes: 11 additions & 11 deletions design-system/pkg/src/menu/test/Menu.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ describe('menu/Menu', () => {
let checkmarks = tree.getAllByRole('img', { hidden: true });
expect(checkmarks.length).toBe(1);

expect(onSelectionChange).toBeCalledTimes(1);
expect(onSelectionChange).toHaveBeenCalledTimes(1);
expect(onSelectionChange.mock.calls[0][0].has('Bleh')).toBeTruthy();
});
it('supports `selectedKeys` (controlled)', () => {
Expand Down Expand Up @@ -175,7 +175,7 @@ describe('menu/Menu', () => {
let checkmarks = tree.getAllByRole('img', { hidden: true });
expect(checkmarks.length).toBe(1);

expect(onSelectionChange).toBeCalledTimes(1);
expect(onSelectionChange).toHaveBeenCalledTimes(1);
expect(onSelectionChange.mock.calls[0][0].has('Bleh')).toBeTruthy();
});

Expand All @@ -202,7 +202,7 @@ describe('menu/Menu', () => {
expect(checkmarks.length).toBe(1);

// Verify onSelectionChange is called
expect(onSelectionChange).toBeCalledTimes(1);
expect(onSelectionChange).toHaveBeenCalledTimes(1);
expect(onSelectionChange.mock.calls[0][0].has('Bleh')).toBeTruthy();
});

Expand All @@ -228,7 +228,7 @@ describe('menu/Menu', () => {
expect(checkmarks.length).toBe(1);

// Verify onSelectionChange is called
expect(onSelectionChange).toBeCalledTimes(1);
expect(onSelectionChange).toHaveBeenCalledTimes(1);
expect(onSelectionChange.mock.calls[0][0].has('Bleh')).toBeTruthy();
});

Expand All @@ -252,7 +252,7 @@ describe('menu/Menu', () => {
expect(checkmarks.length).toBe(0);

// Verify onSelectionChange is not called
expect(onSelectionChange).toBeCalledTimes(0);
expect(onSelectionChange).toHaveBeenCalledTimes(0);
});
});

Expand Down Expand Up @@ -288,7 +288,7 @@ describe('menu/Menu', () => {
checkmarks = tree.getAllByRole('img', { hidden: true });
expect(checkmarks.length).toBe(2);

expect(onSelectionChange).toBeCalledTimes(2);
expect(onSelectionChange).toHaveBeenCalledTimes(2);
expect(onSelectionChange.mock.calls[0][0].has('Blah')).toBeTruthy();
expect(onSelectionChange.mock.calls[1][0].has('Bar')).toBeTruthy();
});
Expand Down Expand Up @@ -333,7 +333,7 @@ describe('menu/Menu', () => {
checkmarks = tree.getAllByRole('img', { hidden: true });
expect(checkmarks.length).toBe(3);

expect(onSelectionChange).toBeCalledTimes(1);
expect(onSelectionChange).toHaveBeenCalledTimes(1);
expect(onSelectionChange.mock.calls[0][0].has('Bleh')).toBeTruthy();
expect(onSelectionChange.mock.calls[0][0].has('Foo')).toBeTruthy();
expect(onSelectionChange.mock.calls[0][0].has('Bar')).toBeTruthy();
Expand Down Expand Up @@ -379,7 +379,7 @@ describe('menu/Menu', () => {
checkmarks = tree.getAllByRole('img', { hidden: true });
expect(checkmarks.length).toBe(2);

expect(onSelectionChange).toBeCalledTimes(1);
expect(onSelectionChange).toHaveBeenCalledTimes(1);
expect(onSelectionChange.mock.calls[0][0].has('Bleh')).toBeTruthy();
});

Expand Down Expand Up @@ -422,7 +422,7 @@ describe('menu/Menu', () => {
checkmarks = tree.getAllByRole('img', { hidden: true });
expect(checkmarks.length).toBe(1);

expect(onSelectionChange).toBeCalledTimes(1);
expect(onSelectionChange).toHaveBeenCalledTimes(1);
expect(onSelectionChange.mock.calls[0][0].has('Bar')).toBeTruthy();
});

Expand All @@ -447,7 +447,7 @@ describe('menu/Menu', () => {
let checkmarks = tree.getAllByRole('img', { hidden: true });
expect(checkmarks.length).toBe(2);

expect(onSelectionChange).toBeCalledTimes(0);
expect(onSelectionChange).toHaveBeenCalledTimes(0);
});
});

Expand Down Expand Up @@ -475,7 +475,7 @@ describe('menu/Menu', () => {
// Make sure nothing is still checked
checkmarks = tree.queryAllByRole('img', { hidden: true });
expect(checkmarks.length).toBe(0);
expect(onSelectionChange).toBeCalledTimes(0);
expect(onSelectionChange).toHaveBeenCalledTimes(0);
});
});

Expand Down
Loading

2 comments on commit bb1bc84

@vercel
Copy link

@vercel vercel bot commented on bb1bc84 Nov 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on bb1bc84 Nov 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

keystatic – ./dev-projects/next-app

keystatic.vercel.app
keystatic-thinkmill-labs.vercel.app
keystatic-git-main-thinkmill-labs.vercel.app

Please sign in to comment.