-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1791 from OpenQDev/vitest-migration
Vitest migration
- Loading branch information
Showing
505 changed files
with
5,702 additions
and
1,170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...s/Admin/Blacklisting/Blacklisting.test.js → .../Admin/Blacklisting/Blacklisting.test.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...n/GrossValueMoved/GrossValueMoved.test.js → .../GrossValueMoved/GrossValueMoved.test.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
components/Admin/Users/Users.test.js → components/Admin/Users/Users.test.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...s/AdminPage/AdminModal/AdminModal.test.js → .../AdminPage/AdminModal/AdminModal.test.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
components/AdminPage/AdminPage.test.js → components/AdminPage/AdminPage.test.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
165 changes: 0 additions & 165 deletions
165
components/AdminPage/SetBudgetAdminPage/SetBudgetAdminPage.test.js
This file was deleted.
Oops, something went wrong.
52 changes: 52 additions & 0 deletions
52
components/AdminPage/SetBudgetAdminPage/SetBudgetAdminPage.test.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/** | ||
* @vi-environment jsdom | ||
*/ | ||
import React from 'react'; | ||
import { render, screen } from '../../../test-utils'; | ||
import SetBudgetAdminPage from '.'; | ||
import InitialState from '../../../store/Store/InitialState'; | ||
import Constants from '../../../test-utils/constant'; | ||
import userEvent from '@testing-library/user-event'; | ||
import MockOpenQClient from '../../../services/ethers/MockOpenQClient'; | ||
|
||
describe('SetBudgetAdminPage', () => { | ||
const bounty = Constants.bounty; | ||
beforeEach(() => { | ||
InitialState.openQClient.reset(); | ||
const observe = vi.fn(); | ||
const disconnect = vi.fn(); | ||
window.IntersectionObserver = vi.fn(() => ({ | ||
observe, | ||
disconnect, | ||
})); | ||
}); | ||
|
||
describe('Fixed price contracts', () => { | ||
it('should allow user to update budget', async () => { | ||
// ARRANGE | ||
const user = userEvent.setup(); | ||
const setFundingGoal = vi.fn(); | ||
const customInitialState = { | ||
...InitialState, | ||
openQClient: new MockOpenQClient({ setFundingGoal }), | ||
}; | ||
render(<SetBudgetAdminPage refreshBounty={() => {}} bounty={bounty} />, {}, customInitialState); | ||
expect(screen.getByText('Set a New Budget for this Contract')).toBeInTheDocument(); | ||
|
||
// ACT | ||
await user.type(screen.getByRole('textbox'), '100'); | ||
await user.click(screen.getByRole('button', { name: 'select token' })); | ||
await user.click(screen.getByRole('button', { name: /link/i })); | ||
await user.click(await screen.findByRole('button', { name: 'Set New Budget' })); | ||
|
||
// ASSERT | ||
expect(await screen.findByText(/Updating Budget.../)).toBeInTheDocument(); | ||
expect(screen.getByText(/our request is being processed.../)).toBeInTheDocument(); | ||
const updatedTexts = await screen.findAllByText(/updated/i); | ||
expect(updatedTexts[0]).toBeInTheDocument(); | ||
expect(await screen.findByText(/budget set to/i)).toBeInTheDocument(); | ||
expect(await screen.findByText(/100.0 LINK/)).toBeInTheDocument(); | ||
expect(setFundingGoal).toBeCalledWith(bounty.bountyId, '100', '0x5FbDB2315678afecb367f032d93F642f64180aa3'); | ||
}); | ||
}); | ||
}); |
2 changes: 1 addition & 1 deletion
2
components/AdminPage/SetBudgetAdminPage/__snapshots__/SetBudgetAdminPage.test.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
components/AdminPage/SetTierAdminPage/__snapshots__/SetTierAdminPage.test.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.