Skip to content

Commit

Permalink
add 2 testcases in TestSourceStringsUploadRequestValidate ( 1 invalid…
Browse files Browse the repository at this point in the history
… request, 1 valid request both with the added UpdateOption field )
  • Loading branch information
jameskim0987 committed Sep 25, 2024
1 parent a22e228 commit e899f78
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions crowdin/model/source_strings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,14 @@ func TestSourceStringsUploadRequestValidate(t *testing.T) {
req: &SourceStringsUploadRequest{StorageID: 1},
err: "branchId is required",
},
{
name: "invalid request",
req: &SourceStringsUploadRequest{StorageID: 1, BranchID: 1, Type: "xlsx", ParserVersion: 1,
LabelIDs: []int{1, 2, 3}, UpdateStrings: toPtr(false), CleanupMode: toPtr(false),
ImportOptions: &SourceStringsImportOptions{FirstLineContainsHeader: toPtr(true),
ImportTranslations: toPtr(true), Scheme: map[string]int{"key": 0}}, UpdateOption: "clear_translations_and_approvals"},
err: "updateStrings must be set to true to use updateOption",
},
{
name: "valid request",
req: &SourceStringsUploadRequest{StorageID: 1, BranchID: 1, Type: "xlsx", ParserVersion: 1,
Expand All @@ -193,6 +201,14 @@ func TestSourceStringsUploadRequestValidate(t *testing.T) {
ImportTranslations: toPtr(true), Scheme: map[string]int{"key": 0}}},
valid: true,
},
{
name: "valid request 2",
req: &SourceStringsUploadRequest{StorageID: 1, BranchID: 1, Type: "xlsx", ParserVersion: 1,
LabelIDs: []int{1, 2, 3}, UpdateStrings: toPtr(true), CleanupMode: toPtr(false),
ImportOptions: &SourceStringsImportOptions{FirstLineContainsHeader: toPtr(true),
ImportTranslations: toPtr(true), Scheme: map[string]int{"key": 0}}, UpdateOption: "clear_translations_and_approvals"},
valid: true,
},
}

for _, tt := range tests {
Expand Down

0 comments on commit e899f78

Please sign in to comment.