Commit da6df6f0 authored by Angelina Filippova's avatar Angelina Filippova

Add test for parsing crontab setting

parent 370faf56
Pipeline #28824 passed with stages
in 5 minutes and 38 seconds
......@@ -198,6 +198,30 @@ describe('Parse tuples', () => {
expect(_.isEqual(expectedResult, result)).toBeTruthy()
})
it('parses crontab setting', () => {
const tuples = [{ tuple: [':crontab', [
{ tuple: ['0 0 * * *', 'Pleroma.Workers.Cron.ClearOauthTokenWorker'] },
{ tuple: ['0 * * * *', 'Pleroma.Workers.Cron.StatsWorker'] },
{ tuple: ['* * * * *', 'Pleroma.Workers.Cron.PurgeExpiredActivitiesWorker']}
]]}]
const expectedResult = { ':crontab': [
{ 'Pleroma.Workers.Cron.ClearOauthTokenWorker': { value: '0 0 * * *'}},
{ 'Pleroma.Workers.Cron.StatsWorker': { value: '0 * * * *'}},
{ 'Pleroma.Workers.Cron.PurgeExpiredActivitiesWorker': { value: '* * * * *'}}
]}
const parsed = parseTuples(tuples, 'Oban')
expect(typeof parsed).toBe('object')
expect(':crontab' in parsed).toBeTruthy()
const result = { ...parsed, ':crontab': parsed[':crontab'].map(el => {
const key = Object.keys(el)[0]
const { id, ...rest } = el[key]
return { [key]: rest }
})}
expect(_.isEqual(expectedResult, result)).toBeTruthy()
})
it('parses match_actor setting in mrf_subchain group', () => {
const tuples = [{ tuple: [":match_actor",
{ '~r/https:\/\/example.com/s': ["Elixir.Pleroma.Web.ActivityPub.MRF.DropPolicy"]}]}]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment