-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test
componentToHints
, exclude test files from be published (#381)
- Loading branch information
Showing
7 changed files
with
84 additions
and
6 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.test.* | ||
|
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
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,70 @@ | ||
import componentsToHints from './componentsToHints'; | ||
// @ts-expect-error | ||
import * as PropTypeComponents from '../../cypress/projects/themed/components'; | ||
import * as TypeScriptComponents from '../../cypress/projects/typescript/components'; | ||
|
||
describe('componentsToHints', () => { | ||
it('should support javascript components with proptypes', () => { | ||
const result = componentsToHints({ | ||
Bar: PropTypeComponents.Bar, | ||
Foo: PropTypeComponents.Foo, | ||
}); | ||
|
||
expect(result).toMatchInlineSnapshot(` | ||
{ | ||
"Bar": { | ||
"attrs": { | ||
"color": [ | ||
"red", | ||
"blue", | ||
], | ||
}, | ||
}, | ||
"Foo": { | ||
"attrs": { | ||
"color": [ | ||
"red", | ||
"blue", | ||
], | ||
}, | ||
}, | ||
} | ||
`); | ||
}); | ||
|
||
it('should support typescript components when provided with type data', () => { | ||
const result = componentsToHints( | ||
{ | ||
Bar: TypeScriptComponents.Bar, | ||
Foo: TypeScriptComponents.Foo, | ||
}, | ||
{ | ||
Bar: { color: ['red', 'blue', 'black'] }, | ||
Foo: { color: ['red', 'blue', 'black'] }, | ||
} | ||
); | ||
|
||
expect(result).toMatchInlineSnapshot(` | ||
{ | ||
"Bar": { | ||
"attrs": { | ||
"color": [ | ||
"red", | ||
"blue", | ||
"black", | ||
], | ||
}, | ||
}, | ||
"Foo": { | ||
"attrs": { | ||
"color": [ | ||
"red", | ||
"blue", | ||
"black", | ||
], | ||
}, | ||
}, | ||
} | ||
`); | ||
}); | ||
}); |
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
File renamed without changes.
File renamed without changes.