Skip to content

Commit

Permalink
chore: rename some variables
Browse files Browse the repository at this point in the history
  • Loading branch information
ihexxa committed Sep 14, 2024
1 parent abb66a9 commit a91d08a
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions packages/insomnia/src/ui/routes/runner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ interface RunnerSettings {
delay: number;
iterationData: UploadDataType[];
file: File | null;
stopOnError: boolean;
bail: boolean;
}

// TODO: remove this when the suite management is introduced
Expand All @@ -104,7 +104,7 @@ let tempRunnerSettings: RunnerSettings = {
delay: 0,
iterationData: [],
file: null,
stopOnError: true,
bail: true,
};

export const Runner: FC<{}> = () => {
Expand Down Expand Up @@ -146,9 +146,9 @@ export const Runner: FC<{}> = () => {
const [uploadData, setUploadData] = useState<UploadDataType[]>(tempRunnerSettings?.iterationData || []);
const [file, setFile] = useState<File | null>(tempRunnerSettings?.file || null);
const [runnerAdvancedSettings, setAdvancedRunnerSettings] = useState({
stopOnError: tempRunnerSettings?.stopOnError || true as boolean,
bail: tempRunnerSettings?.bail || true as boolean,
});
const toggleStopOnError = () => setAdvancedRunnerSettings({ ...runnerAdvancedSettings, stopOnError: !runnerAdvancedSettings.stopOnError });
const toggleBail = () => setAdvancedRunnerSettings({ ...runnerAdvancedSettings, bail: !runnerAdvancedSettings.bail });

const { organizationId, projectId, workspaceId } = useParams() as {
organizationId: string;
Expand Down Expand Up @@ -616,11 +616,11 @@ export const Runner: FC<{}> = () => {
<div>
<label className="flex items-center gap-2">
<input
name='stop-on-error'
onChange={toggleStopOnError}
name='bail'
onChange={toggleBail}
type="checkbox"
disabled={isRunning}
checked={runnerAdvancedSettings.stopOnError}
checked={runnerAdvancedSettings.bail}
/>
Stop run if an error occurs
</label>
Expand Down Expand Up @@ -892,13 +892,13 @@ export const runCollectionAction: ActionFunction = async ({ request, params }) =
}
updateExecution(workspaceId, targetRequest.id);

const getCurIterationUserUploadData = (curIteration: number): UserUploadEnvironment | undefined => {
const getCurrentIterationUserUploadData = (currentIteration: number): UserUploadEnvironment | undefined => {
if (Array.isArray(userUploadEnvs) && userUploadEnvs.length > 0) {
const uploadDataLength = userUploadEnvs.length;
if (uploadDataLength >= curIteration + 1) {
return userUploadEnvs[curIteration];
if (uploadDataLength >= currentIteration + 1) {
return userUploadEnvs[currentIteration];
};
return userUploadEnvs[(curIteration + 1) % uploadDataLength];
return userUploadEnvs[(currentIteration + 1) % uploadDataLength];
}
return undefined;
};
Expand All @@ -921,7 +921,7 @@ export const runCollectionAction: ActionFunction = async ({ request, params }) =
workspaceId,
iteration: i + 1,
iterationCount: iterations,
userUploadEnv: getCurIterationUserUploadData(i),
userUploadEnv: getCurrentIterationUserUploadData(i),
shouldPromptForPathAfterResponse: false,
ignoreUndefinedEnvVariable: true,
testResultCollector: resultCollector,
Expand Down Expand Up @@ -971,7 +971,7 @@ export const runCollectionAction: ActionFunction = async ({ request, params }) =
},
],
};
if (runnerAdvancedSettings.stopOnError) {
if (runnerAdvancedSettings.bail) {
// save previous results in this iteration
testCtx = {
...testCtx,
Expand Down

0 comments on commit a91d08a

Please sign in to comment.