-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 Allow for action to be run in cron workflows
- Loading branch information
Showing
3 changed files
with
47 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
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,41 @@ | ||
import { loadSpec } from './spec'; | ||
import { getResultsTable, getTotals } from '../src/libyear'; | ||
|
||
import { runAction } from './util'; | ||
|
||
describe('cron-workflow', () => { | ||
it('basic-config', async () => { | ||
const run = await runAction({ | ||
eventJson: {}, | ||
eventName: 'schedule', | ||
logToConsole: false, | ||
copySpec: { | ||
spec: '001', | ||
}, | ||
}); | ||
|
||
const spec = await loadSpec('001'); | ||
const specTotals = getTotals(spec); | ||
|
||
// Ensure that table is printed out | ||
expect(run.stdout).toMatch( | ||
`TABLE: ${JSON.stringify(getResultsTable(spec))}` | ||
); | ||
|
||
// Ensure that variables are set | ||
for (const metric of ['drift', 'pulse'] as const) { | ||
expect(specTotals.get(metric)).toBeTruthy(); | ||
expect(run.stdout).toMatch( | ||
`::set-output name=${metric}::${Number(specTotals.get(metric)).toFixed( | ||
2 | ||
)}` | ||
); | ||
} | ||
for (const metric of ['releases', 'major', 'minor', 'patch'] as const) { | ||
expect(specTotals.get(metric)).toBeTruthy(); | ||
expect(run.stdout).toMatch( | ||
`::set-output name=${metric}::${specTotals.get(metric)}` | ||
); | ||
} | ||
}); | ||
}); |