liveBook · Manning

Prompt

As explained in Modern Angular

A prompt is text supplied to an AI system as an instruction or question that guides its generated response.

A prompt is text supplied to ChatGPT as an instruction or question. Adding the relevant technology, such as Angular, makes generated answers more applicable to the task. section 8.4.1

Use prompts to support Angular unit-testing work:

  • Generate arrays of typed mock data, specifying the desired number of objects. section 8.4.1
  • Request mock service implementations while specifying Jest, Observables, omitted tests, and non-spy methods. section 8.4.1

Testing prompt

A focused request can name the component, require Jest and the Angular Testing Library, and provide the component code as input. Review the generated result rather than treating it as deterministic: repeated prompts may produce different answers because ChatGPT is nondeterministic. section 8.4.1

How Modern Angular covers it

How deep it goes
Explains prompt specificity through technology references and constraints, but stops short of a general prompt-engineering framework.
Examples
Demonstrates typed TimeOffRequest arrays, TimeOffRequestService mocks, and generated ConfirmationDialogComponent tests.
What it assumes
Assumes a TypeScript type, service, or component to provide as input and teaches how to add technology and output constraints.
What you can do after
Apply it via ChatGPT to generate test fixtures, dependency mocks, and candidate Angular unit tests.
How it connects
Connects prompts with unit testing, mock data, mock dependencies, TypeScript, Jest, Angular Testing Library, and Observables.

Also explained in

Compare how 50 books explain prompt →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Modern Angular. The section links point to the parts of the book it draws on.