Skip to content

Commit

Permalink
✨ improve: tighten y-padding of dashboard elements
Browse files Browse the repository at this point in the history
  • Loading branch information
kellymears committed Jul 11, 2023
1 parent 51a72f5 commit 0effe15
Showing 1 changed file with 125 additions and 122 deletions.
247 changes: 125 additions & 122 deletions sources/@roots/bud-dashboard/test/app.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,127 +43,130 @@ const mockCompilations: Array<Partial<StatsCompilation>> = [
},
]

describe.skip(`@roots/bud-dashboard app component`, () => {
it(`should render entrypoints`, () => {
const {lastFrame} = render(
<Application
basedir={`/foo/bar`}
mode="production"
compilations={mockCompilations}
displayEntrypoints={true}
/>,
)

expect(stripAnsi(lastFrame())).toMatchSnapshot()
})

it(`should not render entrypoints when entrypoints is empty`, () => {
const {lastFrame} = render(
<Application
basedir={`/foo/bar`}
mode="production"
compilations={[{...mockCompilations[0], entrypoints: {}}]}
displayEntrypoints={true}
/>,
)
})

it(`should not render entrypoints when entrypoints are undefined`, () => {
const {lastFrame} = render(
<Application
basedir={`/foo/bar`}
mode="production"
// @ts-ignore
compilations={[{entrypoints: false}]}
displayEntrypoints={true}
/>,
)

expect(stripAnsi(lastFrame())).toMatchSnapshot()
})

it(`should not render entrypoints when entrypoint assets are undefined`, () => {
const ink = render(
<Application
basedir={`/foo/bar`}
mode="production"
compilations={[
{
entrypoints: {
foo: {assets: []},
describe.skipIf(process.env.CI)(
`@roots/bud-dashboard app component`,
() => {
it(`should render entrypoints`, () => {
const {lastFrame} = render(
<Application
basedir={`/foo/bar`}
mode="production"
compilations={mockCompilations}
displayEntrypoints={true}
/>,
)

expect(stripAnsi(lastFrame())).toMatchSnapshot()
})

it(`should not render entrypoints when entrypoints is empty`, () => {
const {lastFrame} = render(
<Application
basedir={`/foo/bar`}
mode="production"
compilations={[{...mockCompilations[0], entrypoints: {}}]}
displayEntrypoints={true}
/>,
)
})

it(`should not render entrypoints when entrypoints are undefined`, () => {
const {lastFrame} = render(
<Application
basedir={`/foo/bar`}
mode="production"
// @ts-ignore
compilations={[{entrypoints: false}]}
displayEntrypoints={true}
/>,
)

expect(stripAnsi(lastFrame())).toMatchSnapshot()
})

it(`should not render entrypoints when entrypoint assets are undefined`, () => {
const ink = render(
<Application
basedir={`/foo/bar`}
mode="production"
compilations={[
{
entrypoints: {
foo: {assets: []},
},
},
},
]}
displayEntrypoints={true}
/>,
)

expect(stripAnsi(ink.lastFrame())).toMatchSnapshot()

ink.rerender(
<Application
basedir={`/foo/bar`}
mode="production"
compilations={[
{
entrypoints: {
foo: {},
]}
displayEntrypoints={true}
/>,
)

expect(stripAnsi(ink.lastFrame())).toMatchSnapshot()

ink.rerender(
<Application
basedir={`/foo/bar`}
mode="production"
compilations={[
{
entrypoints: {
foo: {},
},
},
},
]}
displayEntrypoints={true}
/>,
)

expect(stripAnsi(ink.lastFrame())).toMatchSnapshot()
})

it(`should render compilation count for multi-compiler`, () => {
const {lastFrame} = render(
<Application
basedir={`/foo/bar`}
mode="production"
compilations={[mockCompilations[0], mockCompilations[0]]}
displayEntrypoints={true}
/>,
)

expect(stripAnsi(lastFrame())).toMatchSnapshot()
})

it(`should render assets`, () => {
const {lastFrame} = render(
<Application
basedir={`/foo/bar`}
mode="production"
compilations={mockCompilations}
displayAssets={true}
/>,
)

expect(stripAnsi(lastFrame())).toMatchSnapshot()
})

it(`should render server info`, () => {
const {lastFrame} = render(
<Application
basedir={`/foo/bar`}
compilations={mockCompilations}
mode="development"
devUrl={new URL(`http://localhost:3000`)}
publicDevUrl={new URL(`http://example.test:3000/`)}
proxy={true}
proxyUrl={new URL(`http://localhost:8080/`)}
publicProxyUrl={new URL(`http://example.test/`)}
displayServerInfo={true}
displayAssets={true}
displayEntrypoints={true}
/>,
)

expect(stripAnsi(lastFrame())).toMatch(/Network/)
expect(stripAnsi(lastFrame())).toMatch(/localhost:8080/)
expect(stripAnsi(lastFrame())).toMatch(/dev/)
expect(stripAnsi(lastFrame())).toMatch(/proxy/)
})
})
]}
displayEntrypoints={true}
/>,
)

expect(stripAnsi(ink.lastFrame())).toMatchSnapshot()
})

it(`should render compilation count for multi-compiler`, () => {
const {lastFrame} = render(
<Application
basedir={`/foo/bar`}
mode="production"
compilations={[mockCompilations[0], mockCompilations[0]]}
displayEntrypoints={true}
/>,
)

expect(stripAnsi(lastFrame())).toMatchSnapshot()
})

it(`should render assets`, () => {
const {lastFrame} = render(
<Application
basedir={`/foo/bar`}
mode="production"
compilations={mockCompilations}
displayAssets={true}
/>,
)

expect(stripAnsi(lastFrame())).toMatchSnapshot()
})

it(`should render server info`, () => {
const {lastFrame} = render(
<Application
basedir={`/foo/bar`}
compilations={mockCompilations}
mode="development"
devUrl={new URL(`http://localhost:3000`)}
publicDevUrl={new URL(`http://example.test:3000/`)}
proxy={true}
proxyUrl={new URL(`http://localhost:8080/`)}
publicProxyUrl={new URL(`http://example.test/`)}
displayServerInfo={true}
displayAssets={true}
displayEntrypoints={true}
/>,
)

expect(stripAnsi(lastFrame())).toMatch(/Network/)
expect(stripAnsi(lastFrame())).toMatch(/localhost:8080/)
expect(stripAnsi(lastFrame())).toMatch(/dev/)
expect(stripAnsi(lastFrame())).toMatch(/proxy/)
})
},
)

0 comments on commit 0effe15

Please sign in to comment.