Tidy up test

This commit is contained in:
Sam Partington 2020-07-31 11:10:00 +01:00
parent ca2b74f2f8
commit f57bf21879
3 changed files with 9 additions and 8 deletions

View file

@ -224,7 +224,7 @@ ava_1.default("default queries are used", async (t) => {
t.deepEqual(resolveQueriesArgs[0].extraSearchPath, undefined);
});
});
ava_1.default("Queries can be overridden in action file", async (t) => {
ava_1.default("Default queries and those from config file can be overridden in action file", async (t) => {
return await util.withTmpDir(async (tmpDir) => {
process.env['RUNNER_TEMP'] = tmpDir;
process.env['GITHUB_WORKSPACE'] = tmpDir;
@ -232,7 +232,9 @@ ava_1.default("Queries can be overridden in action file", async (t) => {
name: my config
queries:
- uses: ./foo`;
// This config item should take precedence.
fs.writeFileSync(path.join(tmpDir, 'input'), inputFileContents, 'utf8');
setInput('config-file', 'input');
// This config item should take precedence over the config file and the default queries.
setInput('queries', './override');
fs.mkdirSync(path.join(tmpDir, 'foo'));
fs.mkdirSync(path.join(tmpDir, 'override'));
@ -254,8 +256,6 @@ ava_1.default("Queries can be overridden in action file", async (t) => {
};
},
});
fs.writeFileSync(path.join(tmpDir, 'input'), inputFileContents, 'utf8');
setInput('config-file', 'input');
setInput('languages', 'javascript');
const config = await configUtils.initConfig();
// Check resolveQueries was called correctly

File diff suppressed because one or more lines are too long

View file

@ -264,7 +264,10 @@ test("Default queries and those from config file can be overridden in action fil
queries:
- uses: ./foo`;
// This config item should take precedence.
fs.writeFileSync(path.join(tmpDir, 'input'), inputFileContents, 'utf8');
setInput('config-file', 'input');
// This config item should take precedence over the config file and the default queries.
setInput('queries', './override');
fs.mkdirSync(path.join(tmpDir, 'foo'));
@ -289,8 +292,6 @@ test("Default queries and those from config file can be overridden in action fil
},
});
fs.writeFileSync(path.join(tmpDir, 'input'), inputFileContents, 'utf8');
setInput('config-file', 'input');
setInput('languages', 'javascript');
const config = await configUtils.initConfig();