-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(TestRun): start test and download when user clicks start button
- Loading branch information
1 parent
7b53089
commit 9e5b09b
Showing
2 changed files
with
46 additions
and
3 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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { useState } from "react"; | ||
export enum TestRunningStatus { | ||
Uninitialized = "Uninitialized", | ||
Running = "Running", | ||
} | ||
const nextTestRunningStatusMap = { | ||
[TestRunningStatus.Uninitialized]: TestRunningStatus.Running as const, | ||
[TestRunningStatus.Running]: TestRunningStatus.Uninitialized as const, | ||
}; | ||
export function useTestRunningStatus() { | ||
const [testRunningStatus, setTestRunningStatus] = | ||
useState<`${TestRunningStatus}`>(TestRunningStatus.Uninitialized); | ||
|
||
function nextTestRunningStatus() { | ||
setTestRunningStatus((prev) => { | ||
return nextTestRunningStatusMap[prev]; | ||
}); | ||
} | ||
|
||
return { | ||
testRunningStatus, | ||
nextTestRunningStatus, | ||
}; | ||
} |