-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: accept various spec formats in API call (#119)
Resolves #118
- Loading branch information
Showing
5 changed files
with
75 additions
and
2 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
39 changes: 39 additions & 0 deletions
39
packages/cypress-cloud/lib/config/__tests__/preprocessParams.test.ts
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,39 @@ | ||
import { describe, expect, it } from "@jest/globals"; | ||
import { preprocessParams } from "../params"; | ||
// generate unit tess for preprocessParams | ||
|
||
describe("preprocessParams", () => { | ||
it.each([ | ||
[ | ||
"should return params with spec as string", | ||
{ spec: "test1,test2" }, | ||
["test1", "test2"], | ||
], | ||
[ | ||
"should return params for an array of comma-separated strings", | ||
{ spec: ["test1,test2", "test3,test4"] }, | ||
["test1", "test2", "test3", "test4"], | ||
], | ||
[ | ||
"should return params with spec as array", | ||
{ spec: ["test1", "test2"] }, | ||
["test1", "test2"], | ||
], | ||
[ | ||
"should return params with spec as single string", | ||
{ spec: "test1" }, | ||
["test1"], | ||
], | ||
[ | ||
"should return params with undefined spec", | ||
{ spec: undefined }, | ||
undefined, | ||
], | ||
["should return params with nullspec", { spec: null }, undefined], | ||
["should return params with empty", { spec: [] }, []], | ||
])("%s", (title, params, expected) => { | ||
// @ts-expect-error | ||
const result = preprocessParams(params); | ||
expect(result.spec).toEqual(expected); | ||
}); | ||
}); |
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