Ringtone app
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 

70 líneas
1.9 KiB

  1. import {FastifyInstance} from 'fastify';
  2. import Uuid from '@tonality/library-uuid';
  3. import {models} from '@tonality/library-common';
  4. import {PrismaClient as RealPrismaClient} from '@prisma/client';
  5. import {MockPrismaRepository} from '../../../../src/utils/mocks';
  6. import {container} from 'tsyringe';
  7. import {build} from '../../../helper';
  8. jest.mock('@prisma/client')
  9. const PrismaClient = RealPrismaClient as jest.Mock
  10. describe('ringtone: /api/search/ringtones', () => {
  11. let app: FastifyInstance
  12. beforeEach(() => {
  13. PrismaClient.mockImplementationOnce(() => ({
  14. user: new MockPrismaRepository<models.User>([
  15. {
  16. id: Uuid.parse('00000000-0000-0000-0000-000000000000'),
  17. username: 'TheoryOfNekomata',
  18. password: 'dummy password',
  19. },
  20. ], 'id'),
  21. ringtone: new MockPrismaRepository<models.Ringtone>([
  22. {
  23. id: Uuid.parse('00000000-0000-0000-0000-000000000000'),
  24. name: 'Ringtone 1',
  25. data: '4c4',
  26. tempo: 120,
  27. createdAt: new Date('2021-05-01'),
  28. updatedAt: new Date('2021-05-01'),
  29. deletedAt: null,
  30. composerUserId: Uuid.parse('00000000-0000-0000-0000-000000000000'),
  31. },
  32. {
  33. id: Uuid.parse('8df2751c-4c05-4831-9408-92af3b4a63e8'),
  34. name: 'Unique Ringtone 2',
  35. data: '4c4 8c4',
  36. tempo: 120,
  37. createdAt: new Date('2021-05-01'),
  38. updatedAt: new Date('2021-05-01'),
  39. deletedAt: null,
  40. composerUserId: Uuid.parse('00000000-0000-0000-0000-000000000000'),
  41. },
  42. {
  43. id: Uuid.parse('c8423931-6a08-41f6-8320-a5ce5367179f'),
  44. name: 'Deleted Ringtone 1',
  45. data: '4c4',
  46. tempo: 120,
  47. createdAt: new Date('2021-05-01'),
  48. updatedAt: new Date('2021-05-01'),
  49. deletedAt: new Date('2021-05-05'),
  50. composerUserId: Uuid.parse('00000000-0000-0000-0000-000000000000'),
  51. },
  52. ], 'id')
  53. }))
  54. })
  55. beforeEach(async () => {
  56. app = await build()
  57. })
  58. afterEach(async () => {
  59. container.clearInstances()
  60. await app.close()
  61. })
  62. it.todo('should foo')
  63. })