This repository has been archived by the owner on Sep 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: store custom formats under name
- Loading branch information
Showing
2 changed files
with
19 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { getDefaults, CustomFormats, CustomFormat } from '../src/formats' | ||
import test from 'ava' | ||
|
||
test('defaults by name', t => { | ||
const bar: CustomFormat = { | ||
name: 'bar', | ||
detect: /bar/, | ||
description: 'custom format named "bar"', | ||
defaultValue: 'my-value', | ||
} | ||
const formats: CustomFormats = { | ||
foo: bar, | ||
} | ||
const defaults = getDefaults(formats) | ||
t.is(defaults.foo, undefined, 'no default under key foo') | ||
t.is(defaults.bar, bar.defaultValue, 'but there is one under name bar') | ||
}) |