mock-events.ts 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. import {
  2. AccountRegistrationEvent,
  3. Customer,
  4. IdentifierChangeRequestEvent,
  5. Order,
  6. OrderItem,
  7. OrderLine,
  8. OrderStateTransitionEvent,
  9. PasswordResetEvent,
  10. ProductVariant,
  11. User,
  12. } from '@vendure/core';
  13. export const mockOrderStateTransitionEvent = new OrderStateTransitionEvent(
  14. 'ArrangingPayment',
  15. 'PaymentSettled',
  16. {} as any,
  17. new Order({
  18. id: '6',
  19. createdAt: '2018-10-31T15:18:29.261Z',
  20. updatedAt: '2018-10-31T15:24:17.000Z',
  21. code: 'T3EPGJKTVZPBD6Z9',
  22. state: 'ArrangingPayment',
  23. active: true,
  24. customer: new Customer({
  25. id: '3',
  26. firstName: 'Test',
  27. lastName: 'Customer',
  28. emailAddress: 'test@test.com',
  29. }),
  30. lines: [
  31. new OrderLine({
  32. id: '5',
  33. featuredAsset: {
  34. preview: 'http://localhost:3000/assets/alexandru-acea-686569-unsplash__preview.jpg',
  35. },
  36. productVariant: new ProductVariant({
  37. id: '2',
  38. name: 'Curvy Monitor 24 inch',
  39. sku: 'C24F390',
  40. }),
  41. items: [
  42. new OrderItem({
  43. id: '6',
  44. unitPrice: 14374,
  45. unitPriceIncludesTax: true,
  46. taxRate: 20,
  47. pendingAdjustments: [],
  48. }),
  49. ],
  50. }),
  51. new OrderLine({
  52. id: '6',
  53. featuredAsset: {
  54. preview: 'http://localhost:3000/assets/vincent-botta-736919-unsplash__preview.jpg',
  55. },
  56. productVariant: new ProductVariant({
  57. id: '4',
  58. name: 'Hard Drive 1TB',
  59. sku: 'IHD455T1',
  60. }),
  61. items: [
  62. new OrderItem({
  63. id: '7',
  64. unitPrice: 3799,
  65. unitPriceIncludesTax: true,
  66. taxRate: 20,
  67. pendingAdjustments: [],
  68. }),
  69. ],
  70. }),
  71. ],
  72. subTotal: 18173,
  73. subTotalBeforeTax: 15144,
  74. shipping: 1000,
  75. shippingMethod: {
  76. code: 'express-flat-rate',
  77. description: 'Express Shipping',
  78. id: '2',
  79. },
  80. shippingAddress: {
  81. fullName: 'Test Customer',
  82. company: '',
  83. streetLine1: '6000 Pagac Land',
  84. streetLine2: '',
  85. city: 'Port Kirsten',
  86. province: 'Avon',
  87. postalCode: 'ZU32 9CP',
  88. country: 'Cabo Verde',
  89. phoneNumber: '',
  90. },
  91. payments: [],
  92. pendingAdjustments: [],
  93. }),
  94. );
  95. export const mockAccountRegistrationEvent = new AccountRegistrationEvent(
  96. {} as any,
  97. new User({
  98. verified: false,
  99. verificationToken: 'MjAxOC0xMS0xM1QxNToxNToxNC42ODda_US2U6UK1WZC7NDAX',
  100. identifier: 'test@test.com',
  101. }),
  102. );
  103. export const mockPasswordResetEvent = new PasswordResetEvent(
  104. {} as any,
  105. new User({
  106. identifier: 'test@test.com',
  107. passwordResetToken: 'MjAxOS0wNC0xNVQxMzozMDozOC43MjFa_MA2FR6HRZBW7JWD6',
  108. }),
  109. );
  110. export const mockEmailAddressChangeEvent = new IdentifierChangeRequestEvent(
  111. {} as any,
  112. new User({
  113. identifier: 'old-address@test.com',
  114. pendingIdentifier: 'new-address@test.com',
  115. identifierChangeToken: 'MjAxOS0wNC0xNVQxMzozMDozOC43MjFa_MA2FR6HRZBW7JWD6',
  116. }),
  117. );