Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
After fixing a bunch of eslint errors, I needed to make some extra
tweaks to make the tests happier.
  • Loading branch information
lencioni committed Jun 25, 2024
1 parent 165f4ff commit 38665cb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 24 deletions.
14 changes: 2 additions & 12 deletions test/integrations/examples/Foo-react-happo.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,24 +108,14 @@ export const dynamicImportExample = () => <DynamicImportExample />;

export const themedExample = () => (
<ThemeContext.Consumer>
{(theme) => (
<button type="button">
I am
{theme}
</button>
)}
{(theme) => <button type="button">I am {theme}</button>}
</ThemeContext.Consumer>
);

export const themedExampleAsync = (renderInDom) => {
renderInDom(
<ThemeContext.Consumer>
{(theme) => (
<button type="button">
I am
{theme}
</button>
)}
{(theme) => <button type="button">I am {theme}</button>}
</ThemeContext.Consumer>,
);
return new Promise((resolve) => {
Expand Down
24 changes: 12 additions & 12 deletions test/integrations/react-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,19 +113,19 @@ it('produces the right html', async () => {
{
component: 'Foo-react',
css: '',
html: '<button>Click meish</button>',
html: '<button type="button">Click meish</button>',
variant: 'anotherVariant',
},
{
component: 'Foo-react',
css: '',
html: '<button>Ready</button>',
html: '<button type="button">Ready</button>',
variant: 'asyncExample',
},
{
component: 'Foo-react',
css: '',
html: '<button></button>',
html: '<button type="button"></button>',
variant: 'asyncWithoutPromise',
},
{
Expand Down Expand Up @@ -161,7 +161,7 @@ it('produces the right html', async () => {
{
component: 'Foo-react',
css: '',
html: '<button>I am in a portal</button>',
html: '<button type="button">I am in a portal</button>',
variant: 'portalExample',
},
{
Expand All @@ -179,38 +179,38 @@ it('produces the right html', async () => {
{
component: 'Foo-react',
css: '',
html: '<button>I am dark</button>',
html: '<button type="button">I am dark</button>',
variant: 'themedExample',
},
{
component: 'Foo-react',
css: '',
html: '<button>I am dark</button>',
html: '<button type="button">I am dark</button>',
variant: 'themedExampleAsync',
},
{
component: 'Generated',
css: '',
html: '<button>Four</button>',
html: '<button type="button">Four</button>',
variant: '_four',
},
{
component: 'Generated',
css: '',
html: '<button>One</button>',
html: '<button type="button">One</button>',
variant: 'one',
stylesheets: ['one'],
},
{
component: 'Generated',
css: '',
html: '<button>Three</button>',
html: '<button type="button">Three</button>',
variant: 'three',
},
{
component: 'Generated',
css: '',
html: '<button>Two</button>',
html: '<button type="button">Two</button>',
variant: 'two',
stylesheets: ['two'],
},
Expand Down Expand Up @@ -261,7 +261,7 @@ it('resolves assets correctly', async () => {
it('produces the right css', async () => {
await subject();
expect(config.targets.chrome.globalCSS[0]).toEqual({
css: '.a { b: c }\n',
css: expect.stringMatching(/.a \{\s*b: c;\s*}\n/),
source: path.resolve(__dirname, 'styles.css'),
});
expect(config.targets.chrome.globalCSS[1]).toEqual({
Expand Down Expand Up @@ -298,7 +298,7 @@ it('works with prerender=false', async () => {
await subject();
expect(config.targets.chrome.globalCSS).toEqual([
{
css: '.a { b: c }\n',
css: expect.stringMatching(/.a \{\s*b: c;\s*}\n/),
source: path.resolve(__dirname, 'styles.css'),
},
{
Expand Down

0 comments on commit 38665cb

Please sign in to comment.