Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): Update cell test template to include id #11749

Merged
merged 2 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('AuthorCell', () => {

it('renders Failure successfully', async () => {
expect(() => {
render(<Failure error={new Error('Oh no')} />)
render(<Failure id={42} error={new Error('Oh no')} />)
}).not.toThrow()
})

Expand All @@ -36,7 +36,7 @@ describe('AuthorCell', () => {

it('renders Success successfully', async () => {
expect(() => {
render(<Success author={standard().author} />)
render(<Success id={42} author={standard().author} />)
}).not.toThrow()
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('BlogPostCell', () => {

it('renders Failure successfully', async () => {
expect(() => {
render(<Failure error={new Error('Oh no')} />)
render(<Failure id={42} error={new Error('Oh no')} />)
}).not.toThrow()
})

Expand All @@ -36,7 +36,7 @@ describe('BlogPostCell', () => {

it('renders Success successfully', async () => {
expect(() => {
render(<Success blogPost={standard().blogPost} />)
render(<Success id={42} blogPost={standard().blogPost} />)
}).not.toThrow()
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('BlogPostsCell', () => {

it('renders Failure successfully', async () => {
expect(() => {
render(<Failure error={new Error('Oh no')} />)
render(<Failure id={42} error={new Error('Oh no')} />)
}).not.toThrow()
})

Expand All @@ -36,7 +36,7 @@ describe('BlogPostsCell', () => {

it('renders Success successfully', async () => {
expect(() => {
render(<Success blogPosts={standard().blogPosts} />)
render(<Success id={42} blogPosts={standard().blogPosts} />)
}).not.toThrow()
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('WaterfallBlogPostCell', () => {

it('renders Failure successfully', async () => {
expect(() => {
render(<Failure error={new Error('Oh no')} />)
render(<Failure id={42} error={new Error('Oh no')} />)
}).not.toThrow()
})

Expand All @@ -36,7 +36,9 @@ describe('WaterfallBlogPostCell', () => {

it('renders Success successfully', async () => {
expect(() => {
render(<Success waterfallBlogPost={standard().waterfallBlogPost} />)
render(
<Success id={42} waterfallBlogPost={standard().waterfallBlogPost} />
)
}).not.toThrow()
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ describe('CustomIdFieldsCell', () => {

it('renders Failure successfully', async () => {
expect(() => {
render(<Failure error={new Error('Oh no')} />)
render(<Failure uuid={'42'} error={new Error('Oh no')} />)
}).not.toThrow()
})

Expand All @@ -178,7 +178,7 @@ describe('CustomIdFieldsCell', () => {

it('renders Success successfully', async () => {
expect(() => {
render(<Success customIdFields={standard().customIdFields} />)
render(<Success uuid={'42'} customIdFields={standard().customIdFields} />)
}).not.toThrow()
})
})
Expand Down Expand Up @@ -283,7 +283,7 @@ describe('CustomIdFieldCell', () => {

it('renders Failure successfully', async () => {
expect(() => {
render(<Failure error={new Error('Oh no')} />)
render(<Failure uuid={'42'} error={new Error('Oh no')} />)
}).not.toThrow()
})

Expand All @@ -295,7 +295,7 @@ describe('CustomIdFieldCell', () => {

it('renders Success successfully', async () => {
expect(() => {
render(<Success customIdField={standard().customIdField} />)
render(<Success uuid={'42'} customIdField={standard().customIdField} />)
}).not.toThrow()
})
})
Expand Down Expand Up @@ -400,7 +400,7 @@ describe('UserProfileCell', () => {

it('renders Failure successfully', async () => {
expect(() => {
render(<Failure error={new Error('Oh no')} />)
render(<Failure id={42} error={new Error('Oh no')} />)
}).not.toThrow()
})

Expand All @@ -412,7 +412,7 @@ describe('UserProfileCell', () => {

it('renders Success successfully', async () => {
expect(() => {
render(<Success userProfile={standard().userProfile} />)
render(<Success id={42} userProfile={standard().userProfile} />)
}).not.toThrow()
})
})
Expand Down Expand Up @@ -517,7 +517,7 @@ describe('UserProfileCell', () => {

it('renders Failure successfully', async () => {
expect(() => {
render(<Failure error={new Error('Oh no')} />)
render(<Failure id={42} error={new Error('Oh no')} />)
}).not.toThrow()
})

Expand All @@ -529,7 +529,7 @@ describe('UserProfileCell', () => {

it('renders Success successfully', async () => {
expect(() => {
render(<Success userProfile={standard().userProfile} />)
render(<Success id={42} userProfile={standard().userProfile} />)
}).not.toThrow()
})
})
Expand Down Expand Up @@ -634,7 +634,7 @@ describe('UserCell', () => {

it('renders Failure successfully', async () => {
expect(() => {
render(<Failure error={new Error('Oh no')} />)
render(<Failure id={42} error={new Error('Oh no')} />)
}).not.toThrow()
})

Expand All @@ -646,7 +646,7 @@ describe('UserCell', () => {

it('renders Success successfully', async () => {
expect(() => {
render(<Success user={standard().user} />)
render(<Success id={42} user={standard().user} />)
}).not.toThrow()
})
})
Expand Down Expand Up @@ -751,7 +751,7 @@ describe('UserProfileCell', () => {

it('renders Failure successfully', async () => {
expect(() => {
render(<Failure error={new Error('Oh no')} />)
render(<Failure id={42} error={new Error('Oh no')} />)
}).not.toThrow()
})

Expand All @@ -763,7 +763,7 @@ describe('UserProfileCell', () => {

it('renders Success successfully', async () => {
expect(() => {
render(<Success userProfile={standard().userProfile} />)
render(<Success id={42} userProfile={standard().userProfile} />)
}).not.toThrow()
})
})
Expand Down Expand Up @@ -835,7 +835,7 @@ describe('BazingaCell', () => {

it('renders Failure successfully', async () => {
expect(() => {
render(<Failure error={new Error('Oh no')} />)
render(<Failure id={42} error={new Error('Oh no')} />)
}).not.toThrow()
})

Expand All @@ -847,7 +847,7 @@ describe('BazingaCell', () => {

it('renders Success successfully', async () => {
expect(() => {
render(<Success bazinga={standard().bazinga} />)
render(<Success id={42} bazinga={standard().bazinga} />)
}).not.toThrow()
})
})
Expand Down Expand Up @@ -1040,7 +1040,7 @@ describe('UserProfileCell', () => {

it('renders Failure successfully', async () => {
expect(() => {
render(<Failure error={new Error('Oh no')} />)
render(<Failure id={42} error={new Error('Oh no')} />)
}).not.toThrow()
})

Expand All @@ -1052,7 +1052,7 @@ describe('UserProfileCell', () => {

it('renders Success successfully', async () => {
expect(() => {
render(<Success userProfile={standard().userProfile} />)
render(<Success id={42} userProfile={standard().userProfile} />)
}).not.toThrow()
})
})
Expand Down Expand Up @@ -1109,7 +1109,7 @@ describe('AddressCell', () => {

it('renders Failure successfully', async () => {
expect(() => {
render(<Failure error={new Error('Oh no')} />)
render(<Failure id={'42'} error={new Error('Oh no')} />)
}).not.toThrow()
})

Expand All @@ -1121,7 +1121,7 @@ describe('AddressCell', () => {

it('renders Success successfully', async () => {
expect(() => {
render(<Success address={standard().address} />)
render(<Success id={'42'} address={standard().address} />)
}).not.toThrow()
})
})
Expand Down Expand Up @@ -1232,7 +1232,7 @@ describe('AddressesCell', () => {

it('renders Failure successfully', async () => {
expect(() => {
render(<Failure error={new Error('Oh no')} />)
render(<Failure id={'42'} error={new Error('Oh no')} />)
}).not.toThrow()
})

Expand All @@ -1244,7 +1244,7 @@ describe('AddressesCell', () => {

it('renders Success successfully', async () => {
expect(() => {
render(<Success addresses={standard().addresses} />)
render(<Success id={'42'} addresses={standard().addresses} />)
}).not.toThrow()
})
})
Expand Down Expand Up @@ -1365,7 +1365,7 @@ describe('MembersCell', () => {

it('renders Failure successfully', async () => {
expect(() => {
render(<Failure error={new Error('Oh no')} />)
render(<Failure id={42} error={new Error('Oh no')} />)
}).not.toThrow()
})

Expand All @@ -1377,7 +1377,7 @@ describe('MembersCell', () => {

it('renders Success successfully', async () => {
expect(() => {
render(<Success members={standard().members} />)
render(<Success id={42} members={standard().members} />)
}).not.toThrow()
})
})
Expand Down
4 changes: 4 additions & 0 deletions packages/cli/src/commands/generate/cell/cell.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ export const files = async ({ name, typescript, ...options }) => {
webPathSection: REDWOOD_WEB_PATH_NAME,
generator: 'cell',
templatePath: 'test.js.template',
templateVars: {
idName,
mockIdValues,
},
})

const storiesFile = await templateForComponentFile({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('${pascalName}Cell', () => {

it('renders Failure successfully', async () => {
expect(() => {
render(<Failure error={new Error('Oh no')} />)
render(<Failure <% if (idName) { %>${idName}={${mockIdValues[0]}} <% } %>error={new Error('Oh no')} />)
}).not.toThrow()
})

Expand All @@ -36,7 +36,7 @@ describe('${pascalName}Cell', () => {

it('renders Success successfully', async () => {
expect(() => {
render(<Success ${camelName}={standard().${camelName}} />)
render(<Success <% if (idName) { %>${idName}={${mockIdValues[0]}} <% } %>${camelName}={standard().${camelName}} />)
}).not.toThrow()
})
})
Loading