Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/parseoptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ export function parseOptions (options: Partial<Options>) {

if (isPresent(opts.byeaster)) opts.freq = RRule.YEARLY

if (!isPresent(opts.interval)) opts.interval = 1

if (!(isPresent(opts.freq) && RRule.FREQUENCIES[opts.freq])) {
throw new Error(`Invalid frequency: ${opts.freq} ${options.freq}`)
}
Expand Down
7 changes: 7 additions & 0 deletions test/parseoptions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,10 @@ describe('byweekday', () => {
expect(options.parsedOptions.byweekday).to.eql([1, 2])
})
})

describe('interval', () => {
it('assigns interval to 1 when not present', () => {
const options = parseOptions({interval: undefined})
expect(options.parsedOptions.interval).to.eql(1)
})
})