mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-14 06:43:25 +08:00
Fix test
This commit is contained in:
parent
5905787bea
commit
407927c8ec
@ -27,7 +27,7 @@ describe('when using the ganttDb', function () {
|
||||
${'1f'} | ${moment.duration.invalid()}
|
||||
`
|
||||
)('should $str resulting in $expected duration', ({ str, expected }) => {
|
||||
expect(ganttDb.parseDuration(str).toString()).not.toEqual(expected);
|
||||
expect(ganttDb.parseDuration(str)).toEqual(expected);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -1,6 +1,31 @@
|
||||
/*
|
||||
* Used to convert Tagged Template literals to object arrays as required by vitest.
|
||||
Used to convert jest's Tagged Template literals to object arrays as required by vitest.
|
||||
|
||||
Example:
|
||||
|
||||
Jest code
|
||||
```ts
|
||||
it.each`
|
||||
str | expected
|
||||
${'1d'} | ${moment.duration(1, 'd')}
|
||||
${'2w'} | ${moment.duration(2, 'w')}
|
||||
`('should parse $str to $expected duration', ({ str, expected }) => {
|
||||
expect(yourFunction(str)).toEqual(expected);
|
||||
});
|
||||
```
|
||||
|
||||
Vitest code
|
||||
```ts
|
||||
it.each(convert`
|
||||
str | expected
|
||||
${'1d'} | ${moment.duration(1, 'd')}
|
||||
${'2w'} | ${moment.duration(2, 'w')}
|
||||
`)('should parse $str to $expected duration', ({ str, expected }) => {
|
||||
expect(yourFunction(str)).toEqual(expected);
|
||||
});
|
||||
```
|
||||
*/
|
||||
|
||||
export const convert = (template: TemplateStringsArray, ...params: any[]) => {
|
||||
const header = template[0]
|
||||
.trim()
|
||||
|
Loading…
x
Reference in New Issue
Block a user