mirror of
https://github.com/go-gitea/gitea.git
synced 2026-02-23 04:18:07 +01:00
Fix test
This commit is contained in:
parent
ce3755483d
commit
a6eb361a23
@ -488,8 +488,7 @@ func TestProjectWorkflowValidation(t *testing.T) {
|
||||
var result map[string]any
|
||||
err = json.Unmarshal(resp.Body.Bytes(), &result)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, "NoActions", result["error"], "Error should be NoActions")
|
||||
assert.NotEmpty(t, result["message"], "Error message should be provided")
|
||||
assert.Equal(t, "At least one action must be configured", result["errorMessage"])
|
||||
})
|
||||
|
||||
// Test 2: Try to update a workflow to have no actions (should fail)
|
||||
@ -546,8 +545,7 @@ func TestProjectWorkflowValidation(t *testing.T) {
|
||||
var result map[string]any
|
||||
err = json.Unmarshal(resp.Body.Bytes(), &result)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, "NoActions", result["error"], "Error should be NoActions")
|
||||
assert.NotEmpty(t, result["message"], "Error message should be provided")
|
||||
assert.Equal(t, "At least one action must be configured", result["errorMessage"])
|
||||
|
||||
// Verify the workflow was not changed
|
||||
unchangedWorkflow, err := project_model.GetWorkflowByID(t.Context(), workflow.ID)
|
||||
|
||||
@ -241,7 +241,7 @@ export function createWorkflowStore(props: any): WorkflowStoreState {
|
||||
);
|
||||
|
||||
if (!hasAtLeastOneAction) {
|
||||
showErrorToast(props.locale.atLeastOneActionRequired || 'At least one action must be configured');
|
||||
showErrorToast(props.locale.atLeastOneActionRequired);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -268,10 +268,8 @@ export function createWorkflowStore(props: any): WorkflowStoreState {
|
||||
let errorMessage = `${props.locale.failedToSaveWorkflow}: ${response.status} ${response.statusText}`;
|
||||
try {
|
||||
const errorData = await response.json();
|
||||
if (errorData.message) {
|
||||
errorMessage = errorData.message;
|
||||
} else if (errorData.error === 'NoActions') {
|
||||
errorMessage = props.locale.atLeastOneActionRequired || 'At least one action must be configured';
|
||||
if (errorData.errorMessage) {
|
||||
errorMessage = errorData.errorMessage;
|
||||
}
|
||||
} catch {
|
||||
const errorText = await response.text();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user