mirror of
https://github.com/morluto/rea.git
synced 2026-12-06 14:59:05 +00:00
test(cli): share fresh providers filter fixtures (#17020)
This commit is contained in:
1 parent
57a33161a3
commit
a86d043048
1 file changed
+14
-27
@@ -273,6 +273,11 @@ describe("CLI output flag value forms", () => {
|
||||
});
|
||||
|
||||
describe("CLI output filter slice validation", () => {
|
||||
const freshProviderFilter = (filter: string) => ({
|
||||
freshProcess: true,
|
||||
arguments: ["providers", "--json", "--filter-output", filter],
|
||||
});
|
||||
|
||||
it.each([
|
||||
"providers[",
|
||||
"providers[0,1].name[",
|
||||
@@ -342,15 +347,9 @@ describe("CLI output filter slice validation", () => {
|
||||
workspaceCliTest(
|
||||
"refuses extra slice bounds instead of returning a partial selection",
|
||||
async ({ cli }) => {
|
||||
const result = await cli.run({
|
||||
freshProcess: true,
|
||||
arguments: [
|
||||
"providers",
|
||||
"--json",
|
||||
"--filter-output",
|
||||
"capabilities[0,1,2].provider.id",
|
||||
],
|
||||
});
|
||||
const result = await cli.run(
|
||||
freshProviderFilter("capabilities[0,1,2].provider.id"),
|
||||
);
|
||||
expect(result.exitCode).toBe(1);
|
||||
expect(result.json).toMatchObject({
|
||||
ok: false,
|
||||
@@ -366,15 +365,9 @@ describe("CLI output filter slice validation", () => {
|
||||
workspaceCliTest(
|
||||
"rejects a nonnumeric slice bound instead of returning no rows",
|
||||
async ({ cli }) => {
|
||||
const result = await cli.run({
|
||||
freshProcess: true,
|
||||
arguments: [
|
||||
"providers",
|
||||
"--json",
|
||||
"--filter-output",
|
||||
"capabilities[0,2x].provider.id",
|
||||
],
|
||||
});
|
||||
const result = await cli.run(
|
||||
freshProviderFilter("capabilities[0,2x].provider.id"),
|
||||
);
|
||||
expect(result.exitCode).toBe(1);
|
||||
expect(result.json).toMatchObject({
|
||||
ok: false,
|
||||
@@ -390,15 +383,9 @@ describe("CLI output filter slice validation", () => {
|
||||
"rejects non-integer array indices with a CLI filter error",
|
||||
async ({ cli }) => {
|
||||
for (const index of ["1.75", "-1.75", "Infinity"]) {
|
||||
const result = await cli.run({
|
||||
freshProcess: true,
|
||||
arguments: [
|
||||
"providers",
|
||||
"--json",
|
||||
"--filter-output",
|
||||
`capabilities[${index}].provider.id`,
|
||||
],
|
||||
});
|
||||
const result = await cli.run(
|
||||
freshProviderFilter(`capabilities[${index}].provider.id`),
|
||||
);
|
||||
expect(result.exitCode).toBe(1);
|
||||
expect(result.json).toMatchObject({
|
||||
ok: false,
|
||||
|
||||
Reference in new issue
Block a user