Commit 7e4cde9e authored by Robert Knight's avatar Robert Knight

Add test to check default date used by `suggestFilename`

The `/* istanbul ignore next */` comment was not working as expected. Just
writing the test was the easiest solution.
parent 46184303
...@@ -32,7 +32,6 @@ export type SuggestedFilenameOptions = { ...@@ -32,7 +32,6 @@ export type SuggestedFilenameOptions = {
export function suggestedFilename({ export function suggestedFilename({
documentMetadata, documentMetadata,
groupName, groupName,
/* istanbul ignore next - test seam */
date = new Date(), date = new Date(),
}: SuggestedFilenameOptions) { }: SuggestedFilenameOptions) {
const filenameSegments = [formatDate(date)]; const filenameSegments = [formatDate(date)];
......
...@@ -51,4 +51,10 @@ describe('suggestedFilename', () => { ...@@ -51,4 +51,10 @@ describe('suggestedFilename', () => {
); );
}); });
}); });
it('defaults to current date', () => {
const result = suggestedFilename({});
const dateStr = new Date().toISOString().slice(0, 10);
assert.equal(result, `${dateStr}-Hypothesis`);
});
}); });
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