Skip to content

Commit

Permalink
fix: remove pdf extension from export filename
Browse files Browse the repository at this point in the history
  • Loading branch information
andostronaut committed Jan 11, 2025
1 parent 05a9512 commit 42f412e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
8 changes: 0 additions & 8 deletions mod_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,6 @@ Deno.test(
},
)

Deno.test(
'generateFileName should return correct filename for pdf type',
() => {
const timestamp = /^prefix_\d{4}-\d{2}-\d{2}_\d{2}-\d{2}-\d{2}\.pdf$/
assert.assert(generateFileName('prefix', 'pdf').match(timestamp))
},
)

Deno.test('generateFileName should handle empty prefix', () => {
const tm = getTimestamp({ type: 'log' })
assert.assertEquals(generateFileName('', 'log'), `_${tm}.log`)
Expand Down
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const getTimestamp = ({ type = 'log' }: { type: 'log' | 'pdf' }): string => {
: `${year}-${month}-${day}_${hours}-${minutes}-${seconds}`
}

const generateFileName = (prefix: string, ext: 'log' | 'pdf'): string => {
const generateFileName = (prefix: string, ext: 'log'): string => {
const timestamp = getTimestamp({ type: ext })
return `${prefix}_${timestamp}.${ext}`
}
Expand Down

0 comments on commit 42f412e

Please sign in to comment.