Skip to content

Commit

Permalink
diffs are good
Browse files Browse the repository at this point in the history
  • Loading branch information
kentcdodds committed Jul 19, 2023
1 parent 479c73c commit d30bd90
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 37 deletions.
2 changes: 1 addition & 1 deletion exercises/01.init/01.problem.named/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,4 @@
"/playwright-report",
"/server-build"
]
}
}
2 changes: 1 addition & 1 deletion exercises/01.init/01.problem.named/tests/e2e/smoke.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { test, expect } from '@playwright/test'

test('can visit the home page', async ({ page }) => {
await page.goto('/')
await expect(page.getByText('Hello World')).toBeVisible()
await expect(page.getByText('Epic Notes')).toBeVisible()

// TODO: figure out how to assert the favicon was loaded
})
1 change: 1 addition & 0 deletions exercises/01.init/README.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Init
32 changes: 30 additions & 2 deletions exercises/09.finished/01.solution/prisma/seed.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import fs from 'fs'
import { faker } from '@faker-js/faker'
import { createUser } from 'tests/db-utils.ts'
import fs from 'fs'
import { prisma } from '~/utils/db.server.ts'

import { UniqueEnforcer } from 'enforce-unique'

const altTexts = [
'a nice country house',
'a city scape',
Expand All @@ -16,6 +17,33 @@ const altTexts = [
`someone at the end of a cry session who's starting to feel a little better.`,
]

const uniqueUsernameEnforcer = new UniqueEnforcer()

export function createUser() {
const firstName = faker.person.firstName()
const lastName = faker.person.lastName()

const username = uniqueUsernameEnforcer
.enforce(() => {
return (
faker.string.alphanumeric({ length: 5 }) +
' ' +
faker.internet.userName({
firstName: firstName.toLowerCase(),
lastName: lastName.toLowerCase(),
})
)
})
.slice(0, 20)
.toLowerCase()
.replace(/[^a-z0-9_]/g, '_')
return {
username,
name: `${firstName} ${lastName}`,
email: `${username}@example.com`,
}
}

async function seed() {
console.log('🌱 Seeding...')
console.time(`🌱 Database has been seeded`)
Expand Down
29 changes: 0 additions & 29 deletions exercises/09.finished/01.solution/tests/db-utils.ts

This file was deleted.

2 changes: 1 addition & 1 deletion exercises/09.finished/01.solution/tests/e2e/smoke.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { test, expect } from '@playwright/test'

test('can visit the home page', async ({ page }) => {
await page.goto('/')
await expect(page.getByText('Hello World')).toBeVisible()
await expect(page.getByText('Epic Notes')).toBeVisible()

// TODO: figure out how to assert the favicon was loaded
})
3 changes: 0 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
{
"path": "exercises/01.init/01.problem.named"
},
{
"path": "exercises/09.finished/01.problem"
},
{
"path": "exercises/09.finished/01.solution"
}
Expand Down

0 comments on commit d30bd90

Please sign in to comment.