Skip to content

Commit 82a56ff

Browse files
Epicshop workshop review (#21)
Co-authored-by: me <me@kentcdodds.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com>
1 parent 3f11065 commit 82a56ff

7 files changed

Lines changed: 24 additions & 67 deletions

File tree

exercises/03.sampling/01.problem.simple/src/index.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,6 @@ test('Simple Sampling', async () => {
276276
content: expect.objectContaining({
277277
type: 'text',
278278
text: expect.any(String),
279-
mimeType: expect.any(String),
280279
}),
281280
}),
282281
]),

exercises/03.sampling/02.problem.advanced/src/index.test.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,6 @@ test('Advanced Sampling', async () => {
280280
content: expect.objectContaining({
281281
type: 'text',
282282
text: expect.stringMatching(/entry/i),
283-
mimeType: 'application/json',
284283
}),
285284
}),
286285
]),
@@ -309,12 +308,10 @@ test('Advanced Sampling', async () => {
309308
params && 'messages' in params && Array.isArray(params.messages),
310309
'🚨 messages array is required',
311310
)
312-
const userMessage = params.messages.find((m) => m.role === 'user') as unknown as { content: { mimeType: string, text: string } }
311+
const userMessage = params.messages.find(
312+
(m) => m.role === 'user',
313+
) as unknown as { content: { text: string } }
313314
invariant(userMessage, '🚨 User message is required')
314-
invariant(
315-
userMessage.content.mimeType === 'application/json',
316-
'🚨 Content should be JSON for structured data',
317-
)
318315

319316
// 🚨 Validate the JSON structure contains required fields
320317
invariant(
@@ -350,7 +347,7 @@ test('Advanced Sampling', async () => {
350347
'🚨 2. Create a meaningful systemPrompt that includes examples of the expected output format (array of tag objects, with examples for existing and new tags).',
351348
)
352349
console.error(
353-
'🚨 3. Structure the user message as JSON with mimeType: "application/json".',
350+
'🚨 3. Structure the user message as JSON (the text field should contain valid JSON).',
354351
)
355352
console.error(
356353
'🚨 4. Include both entry data AND existingTags context in the JSON (e.g., { entry: {...}, existingTags: [...] }).',
@@ -368,10 +365,6 @@ test('Advanced Sampling', async () => {
368365
const params = request.params
369366
if (params) {
370367
console.error(`🚨 Current maxTokens: ${params.maxTokens} (should be >50)`)
371-
console.error(
372-
// @ts-ignore 🤷‍♂️ pretty sure this is correct
373-
`🚨 Current mimeType: ${params.messages?.[0]?.content?.mimeType} (should be "application/json")`,
374-
)
375368
console.error(
376369
`🚨 SystemPrompt contains "example": ${typeof params.systemPrompt === 'string' && params.systemPrompt.toLowerCase().includes('example')}`,
377370
)

exercises/04.long-running-tasks/01.problem.progress/src/index.test.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,6 @@ test('Advanced Sampling', async () => {
281281
content: expect.objectContaining({
282282
type: 'text',
283283
text: expect.stringMatching(/entry/i),
284-
mimeType: 'application/json',
285284
}),
286285
}),
287286
]),
@@ -310,12 +309,10 @@ test('Advanced Sampling', async () => {
310309
params && 'messages' in params && Array.isArray(params.messages),
311310
'🚨 messages array is required',
312311
)
313-
const userMessage = params.messages.find((m) => m.role === 'user') as unknown as { content: { mimeType: string, text: string } }
312+
const userMessage = params.messages.find(
313+
(m) => m.role === 'user',
314+
) as unknown as { content: { text: string } }
314315
invariant(userMessage, '🚨 User message is required')
315-
invariant(
316-
userMessage.content.mimeType === 'application/json',
317-
'🚨 Content should be JSON for structured data',
318-
)
319316

320317
// 🚨 Validate the JSON structure contains required fields
321318
invariant(
@@ -351,7 +348,7 @@ test('Advanced Sampling', async () => {
351348
'🚨 2. Create a meaningful systemPrompt that includes examples of the expected output format (array of tag objects, with examples for existing and new tags).',
352349
)
353350
console.error(
354-
'🚨 3. Structure the user message as JSON with mimeType: "application/json".',
351+
'🚨 3. Structure the user message as JSON (the text field should contain valid JSON).',
355352
)
356353
console.error(
357354
'🚨 4. Include both entry data AND existingTags context in the JSON (e.g., { entry: {...}, existingTags: [...] }).',
@@ -369,10 +366,6 @@ test('Advanced Sampling', async () => {
369366
const params = request.params
370367
if (params) {
371368
console.error(`🚨 Current maxTokens: ${params.maxTokens} (should be >50)`)
372-
console.error(
373-
// @ts-ignore 🤷‍♂️ pretty sure this is correct
374-
`🚨 Current mimeType: ${params.messages?.[0]?.content?.mimeType} (should be "application/json")`,
375-
)
376369
console.error(
377370
`🚨 SystemPrompt contains "example": ${typeof params.systemPrompt === 'string' && params.systemPrompt.toLowerCase().includes('example')}`,
378371
)

exercises/04.long-running-tasks/02.problem.cancellation/src/index.test.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,6 @@ test('Advanced Sampling', async () => {
281281
content: expect.objectContaining({
282282
type: 'text',
283283
text: expect.stringMatching(/entry/i),
284-
mimeType: 'application/json',
285284
}),
286285
}),
287286
]),
@@ -310,12 +309,10 @@ test('Advanced Sampling', async () => {
310309
params && 'messages' in params && Array.isArray(params.messages),
311310
'🚨 messages array is required',
312311
)
313-
const userMessage = params.messages.find((m) => m.role === 'user') as unknown as { content: { mimeType: string, text: string } }
312+
const userMessage = params.messages.find(
313+
(m) => m.role === 'user',
314+
) as unknown as { content: { text: string } }
314315
invariant(userMessage, '🚨 User message is required')
315-
invariant(
316-
userMessage.content.mimeType === 'application/json',
317-
'🚨 Content should be JSON for structured data',
318-
)
319316

320317
// 🚨 Validate the JSON structure contains required fields
321318
invariant(
@@ -351,7 +348,7 @@ test('Advanced Sampling', async () => {
351348
'🚨 2. Create a meaningful systemPrompt that includes examples of the expected output format (array of tag objects, with examples for existing and new tags).',
352349
)
353350
console.error(
354-
'🚨 3. Structure the user message as JSON with mimeType: "application/json".',
351+
'🚨 3. Structure the user message as JSON (the text field should contain valid JSON).',
355352
)
356353
console.error(
357354
'🚨 4. Include both entry data AND existingTags context in the JSON (e.g., { entry: {...}, existingTags: [...] }).',
@@ -369,10 +366,6 @@ test('Advanced Sampling', async () => {
369366
const params = request.params
370367
if (params) {
371368
console.error(`🚨 Current maxTokens: ${params.maxTokens} (should be >50)`)
372-
console.error(
373-
// @ts-ignore 🤷‍♂️ pretty sure this is correct
374-
`🚨 Current mimeType: ${params.messages?.[0]?.content?.mimeType} (should be "application/json")`,
375-
)
376369
console.error(
377370
`🚨 SystemPrompt contains "example": ${typeof params.systemPrompt === 'string' && params.systemPrompt.toLowerCase().includes('example')}`,
378371
)

exercises/05.changes/01.problem.list-changed/src/index.test.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,6 @@ test('Advanced Sampling', async () => {
282282
content: expect.objectContaining({
283283
type: 'text',
284284
text: expect.stringMatching(/entry/i),
285-
mimeType: 'application/json',
286285
}),
287286
}),
288287
]),
@@ -311,12 +310,10 @@ test('Advanced Sampling', async () => {
311310
params && 'messages' in params && Array.isArray(params.messages),
312311
'🚨 messages array is required',
313312
)
314-
const userMessage = params.messages.find((m) => m.role === 'user') as unknown as { content: { mimeType: string, text: string } }
313+
const userMessage = params.messages.find(
314+
(m) => m.role === 'user',
315+
) as unknown as { content: { text: string } }
315316
invariant(userMessage, '🚨 User message is required')
316-
invariant(
317-
userMessage.content.mimeType === 'application/json',
318-
'🚨 Content should be JSON for structured data',
319-
)
320317

321318
// 🚨 Validate the JSON structure contains required fields
322319
invariant(
@@ -352,7 +349,7 @@ test('Advanced Sampling', async () => {
352349
'🚨 2. Create a meaningful systemPrompt that includes examples of the expected output format (array of tag objects, with examples for existing and new tags).',
353350
)
354351
console.error(
355-
'🚨 3. Structure the user message as JSON with mimeType: "application/json".',
352+
'🚨 3. Structure the user message as JSON (the text field should contain valid JSON).',
356353
)
357354
console.error(
358355
'🚨 4. Include both entry data AND existingTags context in the JSON (e.g., { entry: {...}, existingTags: [...] }).',
@@ -370,10 +367,6 @@ test('Advanced Sampling', async () => {
370367
const params = request.params
371368
if (params) {
372369
console.error(`🚨 Current maxTokens: ${params.maxTokens} (should be >50)`)
373-
console.error(
374-
// @ts-ignore 🤷‍♂️ pretty sure this is correct
375-
`🚨 Current mimeType: ${params.messages?.[0]?.content?.mimeType} (should be "application/json")`,
376-
)
377370
console.error(
378371
`🚨 SystemPrompt contains "example": ${typeof params.systemPrompt === 'string' && params.systemPrompt.toLowerCase().includes('example')}`,
379372
)

exercises/05.changes/02.problem.resources-list-changed/src/index.test.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,6 @@ test('Advanced Sampling', async () => {
284284
content: expect.objectContaining({
285285
type: 'text',
286286
text: expect.stringMatching(/entry/i),
287-
mimeType: 'application/json',
288287
}),
289288
}),
290289
]),
@@ -313,12 +312,10 @@ test('Advanced Sampling', async () => {
313312
params && 'messages' in params && Array.isArray(params.messages),
314313
'🚨 messages array is required',
315314
)
316-
const userMessage = params.messages.find((m) => m.role === 'user') as unknown as { content: { mimeType: string, text: string } }
315+
const userMessage = params.messages.find(
316+
(m) => m.role === 'user',
317+
) as unknown as { content: { text: string } }
317318
invariant(userMessage, '🚨 User message is required')
318-
invariant(
319-
userMessage.content.mimeType === 'application/json',
320-
'🚨 Content should be JSON for structured data',
321-
)
322319

323320
// 🚨 Validate the JSON structure contains required fields
324321
invariant(
@@ -354,7 +351,7 @@ test('Advanced Sampling', async () => {
354351
'🚨 2. Create a meaningful systemPrompt that includes examples of the expected output format (array of tag objects, with examples for existing and new tags).',
355352
)
356353
console.error(
357-
'🚨 3. Structure the user message as JSON with mimeType: "application/json".',
354+
'🚨 3. Structure the user message as JSON (the text field should contain valid JSON).',
358355
)
359356
console.error(
360357
'🚨 4. Include both entry data AND existingTags context in the JSON (e.g., { entry: {...}, existingTags: [...] }).',
@@ -372,10 +369,6 @@ test('Advanced Sampling', async () => {
372369
const params = request.params
373370
if (params) {
374371
console.error(`🚨 Current maxTokens: ${params.maxTokens} (should be >50)`)
375-
console.error(
376-
// @ts-ignore 🤷‍♂️ pretty sure this is correct
377-
`🚨 Current mimeType: ${params.messages?.[0]?.content?.mimeType} (should be "application/json")`,
378-
)
379372
console.error(
380373
`🚨 SystemPrompt contains "example": ${typeof params.systemPrompt === 'string' && params.systemPrompt.toLowerCase().includes('example')}`,
381374
)

exercises/05.changes/03.problem.subscriptions/src/index.test.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,6 @@ test('Advanced Sampling', async () => {
285285
content: expect.objectContaining({
286286
type: 'text',
287287
text: expect.stringMatching(/entry/i),
288-
mimeType: 'application/json',
289288
}),
290289
}),
291290
]),
@@ -314,12 +313,10 @@ test('Advanced Sampling', async () => {
314313
params && 'messages' in params && Array.isArray(params.messages),
315314
'🚨 messages array is required',
316315
)
317-
const userMessage = params.messages.find((m) => m.role === 'user') as unknown as { content: { mimeType: string, text: string } }
316+
const userMessage = params.messages.find(
317+
(m) => m.role === 'user',
318+
) as unknown as { content: { text: string } }
318319
invariant(userMessage, '🚨 User message is required')
319-
invariant(
320-
userMessage.content.mimeType === 'application/json',
321-
'🚨 Content should be JSON for structured data',
322-
)
323320

324321
// 🚨 Validate the JSON structure contains required fields
325322
invariant(
@@ -355,7 +352,7 @@ test('Advanced Sampling', async () => {
355352
'🚨 2. Create a meaningful systemPrompt that includes examples of the expected output format (array of tag objects, with examples for existing and new tags).',
356353
)
357354
console.error(
358-
'🚨 3. Structure the user message as JSON with mimeType: "application/json".',
355+
'🚨 3. Structure the user message as JSON (the text field should contain valid JSON).',
359356
)
360357
console.error(
361358
'🚨 4. Include both entry data AND existingTags context in the JSON (e.g., { entry: {...}, existingTags: [...] }).',
@@ -373,10 +370,6 @@ test('Advanced Sampling', async () => {
373370
const params = request.params
374371
if (params) {
375372
console.error(`🚨 Current maxTokens: ${params.maxTokens} (should be >50)`)
376-
console.error(
377-
// @ts-ignore 🤷‍♂️ pretty sure this is correct
378-
`🚨 Current mimeType: ${params.messages?.[0]?.content?.mimeType} (should be "application/json")`,
379-
)
380373
console.error(
381374
`🚨 SystemPrompt contains "example": ${typeof params.systemPrompt === 'string' && params.systemPrompt.toLowerCase().includes('example')}`,
382375
)

0 commit comments

Comments
 (0)