redwoodjs / redwood-tutorial

The end state after completing the RedwoodJS introduction tutorial
https://redwoodjs.com/tutorial
40 stars 109 forks source link

fix: Add id to mockCurrentUser #89

Open Alonski opened 2 years ago

Alonski commented 2 years ago

According to Typescript mockCurrentUser expects a required id.

In Javascript we don't notice this.

Come to think of it... Should this tutorial be in Typescript? Or maybe should we offer a Typescript version?

dthyresson commented 2 years ago

@Alonski does the test fail due to the lack of the id?

Alonski commented 2 years ago

@dthyresson I'm not sure if the test fails or not. I can check. I just found this while converting to Typescript

cannikin commented 2 years ago

Hmm, what if the primary key column isn't named id? Is the Typescript behind there actually smart enough to know that, and expect the correct key there, or is it just hardcoded to id somewhere?

When we originally wrote mockCurrentUser I thought it just took an object and presented that as the return from any currentUser call...not sure why it would need to require a certain set of keys on that object?