-
-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
patch(vest): Use the same test mutation function everywhere
- Loading branch information
Showing
2 changed files
with
9 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,14 @@ | ||
import VestTest from 'VestTest'; | ||
import { useTestObjects } from 'stateHooks'; | ||
import { useSetTests } from 'stateHooks'; | ||
|
||
export function emptyTestObjects(): void { | ||
const [, setTestObjects] = useTestObjects(); | ||
setTestObjects(({ prev }) => ({ prev, current: [] })); | ||
useSetTests(() => []); | ||
} | ||
|
||
export function setTestObjects(...args: VestTest[]): void { | ||
const [, setTestObjects] = useTestObjects(); | ||
setTestObjects(({ prev }) => ({ prev, current: [...args] })); | ||
useSetTests(() => [...args]); | ||
} | ||
|
||
export function addTestObject(addedTests: VestTest[] | VestTest): void { | ||
const [, setTestObjects] = useTestObjects(); | ||
|
||
setTestObjects(({ prev, current }) => ({ | ||
prev, | ||
current: current.concat(addedTests), | ||
})); | ||
useSetTests(tests => tests.concat(addedTests)); | ||
} |
33cd6d9
There was a problem hiding this comment.
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:
vest-next – ./website
vest-next-ealush.vercel.app
vest-next-git-latest-ealush.vercel.app
vest-next.vercel.app
vest-website.vercel.app