Skip to content

Commit

Permalink
Codemod to include full-name in test-project signup (#7124)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobbe committed Dec 13, 2022
1 parent ef3600d commit 51d21a0
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const standard = defineScenario<Prisma.PostCreateArgs>({
body: 'String',
author: {
create: {
email: 'String2269056',
email: 'String2399859',
hashedPassword: 'String',
fullName: 'String',
salt: 'String',
Expand All @@ -24,7 +24,7 @@ export const standard = defineScenario<Prisma.PostCreateArgs>({
body: 'String',
author: {
create: {
email: 'String1293889',
email: 'String4475086',
hashedPassword: 'String',
fullName: 'String',
salt: 'String',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ export const standard = defineScenario<Prisma.UserCreateArgs>({
user: {
one: {
data: {
email: 'String8692738',
email: 'String3489044',
hashedPassword: 'String',
fullName: 'String',
salt: 'String',
},
},
two: {
data: {
email: 'String810758',
email: 'String8239407',
hashedPassword: 'String',
fullName: 'String',
salt: 'String',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ const SignupPage = () => {
}, [])

const onSubmit = async (data: Record<string, string>) => {
const response = await signUp({ ...data })
const response = await signUp({
username: data.username,
password: data.password,
'full-name': data['full-name'],
})

if (response.message) {
toast(response.message)
Expand Down
16 changes: 11 additions & 5 deletions tasks/test-project/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -517,11 +517,17 @@ async function apiTasks(outputPath, { verbose, linkWithLatestFwBuild }) {
.replaceAll('username', 'full-name')
.replaceAll('Username', 'Full Name')

const newContentSignupPageTs = contentSignupPageTs.replace(
'<FieldError name="password" className="rw-field-error" />',
'<FieldError name="password" className="rw-field-error" />\n' +
fullNameFields
)
const newContentSignupPageTs = contentSignupPageTs
.replace(
'<FieldError name="password" className="rw-field-error" />',
'<FieldError name="password" className="rw-field-error" />\n' +
fullNameFields
)
// include full-name in the data we pass to `signUp()`
.replace(
'password: data.password',
"password: data.password, 'full-name': data['full-name']"
)

fs.writeFileSync(pathSignupPageTs, newContentSignupPageTs)

Expand Down

0 comments on commit 51d21a0

Please sign in to comment.