ぼざクリタグ広場 https://hub.nizika.monster
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

77 lines
2.3 KiB

  1. import type { Material, Post, TagWithSections, User, WikiPage } from '@/types'
  2. export const buildTag = (overrides: Partial<TagWithSections> = {}): TagWithSections => ({
  3. id: 1,
  4. name: 'テストタグ',
  5. category: 'general',
  6. aliases: [],
  7. parents: [],
  8. postCount: 12,
  9. createdAt: '2026-01-02T03:04:05.000Z',
  10. updatedAt: '2026-01-03T03:04:05.000Z',
  11. hasWiki: false,
  12. materialId: null,
  13. hasDeerjikists: false,
  14. matchedAlias: null,
  15. sections: [],
  16. children: [],
  17. ...overrides,
  18. })
  19. export const buildPost = (overrides: Partial<Post> = {}): Post => ({
  20. id: 1,
  21. versionNo: 1,
  22. url: 'https://example.com/post/1',
  23. title: 'テスト投稿',
  24. thumbnail: 'https://example.com/thumb.jpg',
  25. thumbnailBase: null,
  26. tags: [buildTag ()],
  27. parentPosts: [],
  28. childPosts: [],
  29. siblingPosts: {},
  30. viewed: false,
  31. related: [],
  32. originalCreatedFrom: null,
  33. originalCreatedBefore: null,
  34. createdAt: '2026-01-02T03:04:05.000Z',
  35. updatedAt: '2026-01-03T03:04:05.000Z',
  36. uploadedUser: { id: 1, name: 'tester' },
  37. ...overrides,
  38. })
  39. export const buildUser = (overrides: Partial<User> = {}): User => ({
  40. id: 1,
  41. name: 'tester',
  42. inheritanceCode: 'inherit-code',
  43. role: 'member',
  44. ...overrides,
  45. })
  46. export const buildWikiPage = (overrides: Partial<WikiPage> = {}): WikiPage => ({
  47. id: 1,
  48. title: 'テストWiki',
  49. createdUserId: 1,
  50. updatedUserId: 1,
  51. createdAt: '2026-01-02T03:04:05.000Z',
  52. updatedAt: '2026-01-03T03:04:05.000Z',
  53. body: '# 本文',
  54. revisionId: 10,
  55. pred: null,
  56. succ: null,
  57. ...overrides,
  58. })
  59. export const buildMaterial = (overrides: Partial<Material> = {}): Material => ({
  60. id: 1,
  61. tag: buildTag (),
  62. file: null,
  63. url: null,
  64. wikiPageBody: null,
  65. contentType: null,
  66. createdAt: '2026-01-02T03:04:05.000Z',
  67. createdByUser: { id: 1, name: 'creator' },
  68. updatedAt: '2026-01-03T03:04:05.000Z',
  69. updatedByUser: { id: 2, name: 'updater' },
  70. ...overrides,
  71. })