fixtures.ts 998 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. export const diff = {
  2. before: {
  3. name: "src/greet.ts",
  4. contents: `export function greet(name: string) {
  5. return \`Hello, \${name}!\`
  6. }
  7. `,
  8. },
  9. after: {
  10. name: "src/greet.ts",
  11. contents: `export function greet(name: string, excited = false) {
  12. const message = \`Hello, \${name}!\`
  13. return excited ? \`\${message}!!\` : message
  14. }
  15. `,
  16. },
  17. }
  18. export const code = {
  19. name: "src/calc.ts",
  20. contents: `export function sum(values: number[]) {
  21. return values.reduce((total, value) => total + value, 0)
  22. }
  23. export function average(values: number[]) {
  24. if (values.length === 0) return 0
  25. return sum(values) / values.length
  26. }
  27. `,
  28. }
  29. export const markdown = [
  30. "# Markdown",
  31. "",
  32. "Use **Markdown** for rich text.",
  33. "",
  34. "## Highlights",
  35. "- Headings, lists, and code blocks",
  36. "- Inline `code` and links",
  37. "",
  38. "```ts",
  39. "export const value = 42",
  40. "```",
  41. "",
  42. "More at https://example.com/docs",
  43. ].join("\n")
  44. export const changes = {
  45. additions: 18,
  46. deletions: 6,
  47. }