Use defaultAugmentationProperties in tests
Using defaultAugmentationProperties to generated expected test output eliminates the need to change individual tests when we add a new field to AugmentationProperties.
This commit is contained in:
parent
ef36b69c6d
commit
1764e3d1c2
2 changed files with 28 additions and 53 deletions
|
|
@ -14,7 +14,11 @@ import * as actionsUtil from "./actions-util";
|
|||
import { GitHubApiDetails } from "./api-client";
|
||||
import { CliError } from "./cli-errors";
|
||||
import * as codeql from "./codeql";
|
||||
import { AugmentationProperties, Config } from "./config-utils";
|
||||
import {
|
||||
AugmentationProperties,
|
||||
Config,
|
||||
defaultAugmentationProperties,
|
||||
} from "./config-utils";
|
||||
import * as defaults from "./defaults.json";
|
||||
import { DocUrl } from "./doc-url";
|
||||
import { FeatureEnablement } from "./feature-flags";
|
||||
|
|
@ -537,8 +541,7 @@ test(
|
|||
"basic",
|
||||
injectedConfigMacro,
|
||||
{
|
||||
queriesInputCombines: false,
|
||||
packsInputCombines: false,
|
||||
...defaultAugmentationProperties,
|
||||
},
|
||||
{},
|
||||
{},
|
||||
|
|
@ -548,8 +551,7 @@ test(
|
|||
"injected packs from input",
|
||||
injectedConfigMacro,
|
||||
{
|
||||
queriesInputCombines: false,
|
||||
packsInputCombines: false,
|
||||
...defaultAugmentationProperties,
|
||||
packsInput: ["xxx", "yyy"],
|
||||
},
|
||||
{},
|
||||
|
|
@ -562,7 +564,7 @@ test(
|
|||
"injected packs from input with existing packs combines",
|
||||
injectedConfigMacro,
|
||||
{
|
||||
queriesInputCombines: false,
|
||||
...defaultAugmentationProperties,
|
||||
packsInputCombines: true,
|
||||
packsInput: ["xxx", "yyy"],
|
||||
},
|
||||
|
|
@ -584,8 +586,7 @@ test(
|
|||
"injected packs from input with existing packs overrides",
|
||||
injectedConfigMacro,
|
||||
{
|
||||
queriesInputCombines: false,
|
||||
packsInputCombines: false,
|
||||
...defaultAugmentationProperties,
|
||||
packsInput: ["xxx", "yyy"],
|
||||
},
|
||||
{
|
||||
|
|
@ -605,8 +606,7 @@ test(
|
|||
"injected queries from input",
|
||||
injectedConfigMacro,
|
||||
{
|
||||
queriesInputCombines: false,
|
||||
packsInputCombines: false,
|
||||
...defaultAugmentationProperties,
|
||||
queriesInput: [{ uses: "xxx" }, { uses: "yyy" }],
|
||||
},
|
||||
{},
|
||||
|
|
@ -626,8 +626,7 @@ test(
|
|||
"injected queries from input overrides",
|
||||
injectedConfigMacro,
|
||||
{
|
||||
queriesInputCombines: false,
|
||||
packsInputCombines: false,
|
||||
...defaultAugmentationProperties,
|
||||
queriesInput: [{ uses: "xxx" }, { uses: "yyy" }],
|
||||
},
|
||||
{
|
||||
|
|
@ -651,8 +650,8 @@ test(
|
|||
"injected queries from input combines",
|
||||
injectedConfigMacro,
|
||||
{
|
||||
...defaultAugmentationProperties,
|
||||
queriesInputCombines: true,
|
||||
packsInputCombines: false,
|
||||
queriesInput: [{ uses: "xxx" }, { uses: "yyy" }],
|
||||
},
|
||||
{
|
||||
|
|
@ -679,6 +678,7 @@ test(
|
|||
"injected queries from input combines 2",
|
||||
injectedConfigMacro,
|
||||
{
|
||||
...defaultAugmentationProperties,
|
||||
queriesInputCombines: true,
|
||||
packsInputCombines: true,
|
||||
queriesInput: [{ uses: "xxx" }, { uses: "yyy" }],
|
||||
|
|
@ -700,6 +700,7 @@ test(
|
|||
"injected queries and packs, but empty",
|
||||
injectedConfigMacro,
|
||||
{
|
||||
...defaultAugmentationProperties,
|
||||
queriesInputCombines: true,
|
||||
packsInputCombines: true,
|
||||
queriesInput: [],
|
||||
|
|
|
|||
|
|
@ -834,13 +834,8 @@ test(
|
|||
undefined,
|
||||
[Language.javascript],
|
||||
{
|
||||
queriesInputCombines: false,
|
||||
queriesInput: undefined,
|
||||
qualityQueriesInput: undefined,
|
||||
packsInputCombines: false,
|
||||
packsInput: undefined,
|
||||
defaultQueryFilters: [],
|
||||
} as configUtils.AugmentationProperties,
|
||||
...configUtils.defaultAugmentationProperties,
|
||||
},
|
||||
);
|
||||
|
||||
test(
|
||||
|
|
@ -851,13 +846,9 @@ test(
|
|||
undefined,
|
||||
[Language.javascript],
|
||||
{
|
||||
queriesInputCombines: false,
|
||||
...configUtils.defaultAugmentationProperties,
|
||||
queriesInput: [{ uses: "a" }, { uses: "b" }, { uses: "c" }, { uses: "d" }],
|
||||
qualityQueriesInput: undefined,
|
||||
packsInputCombines: false,
|
||||
packsInput: undefined,
|
||||
defaultQueryFilters: [],
|
||||
} as configUtils.AugmentationProperties,
|
||||
},
|
||||
);
|
||||
|
||||
test(
|
||||
|
|
@ -868,13 +859,10 @@ test(
|
|||
undefined,
|
||||
[Language.javascript],
|
||||
{
|
||||
...configUtils.defaultAugmentationProperties,
|
||||
queriesInputCombines: true,
|
||||
queriesInput: [{ uses: "a" }, { uses: "b" }, { uses: "c" }, { uses: "d" }],
|
||||
qualityQueriesInput: undefined,
|
||||
packsInputCombines: false,
|
||||
packsInput: undefined,
|
||||
defaultQueryFilters: [],
|
||||
} as configUtils.AugmentationProperties,
|
||||
},
|
||||
);
|
||||
|
||||
test(
|
||||
|
|
@ -885,18 +873,14 @@ test(
|
|||
" a, b , c, d",
|
||||
[Language.javascript],
|
||||
{
|
||||
queriesInputCombines: false,
|
||||
queriesInput: undefined,
|
||||
...configUtils.defaultAugmentationProperties,
|
||||
qualityQueriesInput: [
|
||||
{ uses: "a" },
|
||||
{ uses: "b" },
|
||||
{ uses: "c" },
|
||||
{ uses: "d" },
|
||||
],
|
||||
packsInputCombines: false,
|
||||
packsInput: undefined,
|
||||
defaultQueryFilters: [],
|
||||
} as configUtils.AugmentationProperties,
|
||||
},
|
||||
);
|
||||
|
||||
test(
|
||||
|
|
@ -907,7 +891,7 @@ test(
|
|||
"e, f , g,h",
|
||||
[Language.javascript],
|
||||
{
|
||||
queriesInputCombines: false,
|
||||
...configUtils.defaultAugmentationProperties,
|
||||
queriesInput: [{ uses: "a" }, { uses: "b" }, { uses: "c" }, { uses: "d" }],
|
||||
qualityQueriesInput: [
|
||||
{ uses: "e" },
|
||||
|
|
@ -915,10 +899,7 @@ test(
|
|||
{ uses: "g" },
|
||||
{ uses: "h" },
|
||||
],
|
||||
packsInputCombines: false,
|
||||
packsInput: undefined,
|
||||
defaultQueryFilters: [],
|
||||
} as configUtils.AugmentationProperties,
|
||||
},
|
||||
);
|
||||
|
||||
test(
|
||||
|
|
@ -929,13 +910,9 @@ test(
|
|||
undefined,
|
||||
[Language.javascript],
|
||||
{
|
||||
queriesInputCombines: false,
|
||||
queriesInput: undefined,
|
||||
qualityQueriesInput: undefined,
|
||||
packsInputCombines: false,
|
||||
...configUtils.defaultAugmentationProperties,
|
||||
packsInput: ["codeql/a", "codeql/b", "codeql/c", "codeql/d"],
|
||||
defaultQueryFilters: [],
|
||||
} as configUtils.AugmentationProperties,
|
||||
},
|
||||
);
|
||||
|
||||
test(
|
||||
|
|
@ -946,13 +923,10 @@ test(
|
|||
undefined,
|
||||
[Language.javascript],
|
||||
{
|
||||
queriesInputCombines: false,
|
||||
queriesInput: undefined,
|
||||
qualityQueriesInput: undefined,
|
||||
...configUtils.defaultAugmentationProperties,
|
||||
packsInputCombines: true,
|
||||
packsInput: ["codeql/a", "codeql/b", "codeql/c", "codeql/d"],
|
||||
defaultQueryFilters: [],
|
||||
} as configUtils.AugmentationProperties,
|
||||
},
|
||||
);
|
||||
|
||||
const calculateAugmentationErrorMacro = test.macro({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue