Skip to content

Commit

Permalink
Merge pull request #69 from ufosc/feature/tracks-queue
Browse files Browse the repository at this point in the history
fix issue with jest module import
  • Loading branch information
IkeHunter authored Nov 7, 2024
2 parents 567ac3f + 482b5b0 commit 93c6efb
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion docker-compose.network.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ services:
depends_on:
- postgres
- pgadmin
- kafka
# - kafka
- redis
volumes:
- ./src:/app/src
Expand Down
3 changes: 1 addition & 2 deletions src/jukebox/tests/jukebox.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ import { NetworkModule } from 'src/network/network.module'
import { SpotifyAccount } from 'src/spotify/entities/spotify-account.entity'
import { SpotifyAuthService } from 'src/spotify/spotify-auth.service'
import { SpotifyService } from 'src/spotify/spotify.service'
import { mockCache, mockRepo, type MockType } from 'src/utils'
import { AxiosProvider } from 'src/utils/providers/axios.provider'
import type { Repository } from 'typeorm'
import { mockCache, mockRepo } from 'src/utils/testing'
import { Jukebox, JukeboxLinkAssignment } from '../entities/jukebox.entity'
import { JukeboxController } from '../jukebox.controller'
import { JukeboxService } from '../jukebox.service'
Expand Down
2 changes: 1 addition & 1 deletion src/jukebox/tests/jukebox.gateway.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Test, TestingModule } from '@nestjs/testing'
import { getRepositoryToken } from '@nestjs/typeorm'
import { AppGateway } from 'src/app.gateway'
import { SpotifyService } from 'src/spotify/spotify.service'
import { mockCache, mockRepo } from 'src/utils'
import { mockCache, mockRepo } from 'src/utils/testing'
import { Jukebox, JukeboxLinkAssignment } from '../entities/jukebox.entity'
import { JukeboxGateway } from '../jukebox.gateway'
import { JukeboxService } from '../jukebox.service'
Expand Down
2 changes: 1 addition & 1 deletion src/jukebox/tests/jukebox.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { TestingModule } from '@nestjs/testing'
import { Test } from '@nestjs/testing'
import { getRepositoryToken } from '@nestjs/typeorm'
import { SpotifyAccount } from 'src/spotify/entities/spotify-account.entity'
import type { MockType } from 'src/utils'
import type { MockType } from 'src/utils/testing'
import type { Repository } from 'typeorm'
import { Jukebox, JukeboxLinkAssignment } from '../entities/jukebox.entity'
import { JukeboxService } from '../jukebox.service'
Expand Down
2 changes: 1 addition & 1 deletion src/jukebox/track-queue/tests/track-queue.service.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { TestingModule } from '@nestjs/testing'
import { Test } from '@nestjs/testing'
import { mockCache } from 'src/utils'
import { mockCache } from 'src/utils/testing'
import { TrackQueueService } from '../track-queue.service'

describe('TrackQueueService', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/spotify/tests/spotify.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Test } from '@nestjs/testing'
import { getRepositoryToken } from '@nestjs/typeorm'
import Axios from 'axios'
import { NetworkModule } from 'src/network/network.module'
import type { MockType } from 'src/utils'
import type { MockType } from 'src/utils/testing'
import type { Repository } from 'typeorm'
import { SpotifyAccount } from '../entities/spotify-account.entity'
import { SpotifyAuthService } from '../spotify-auth.service'
Expand Down
2 changes: 1 addition & 1 deletion src/spotify/tests/spotify.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Test } from '@nestjs/testing'
import { getRepositoryToken } from '@nestjs/typeorm'
import Axios from 'axios'
import { Model } from 'mongoose'
import type { MockType } from 'src/utils'
import type { MockType } from 'src/utils/testing'
import type { Repository } from 'typeorm'
import { SpotifyAccount } from '../entities/spotify-account.entity'
import { SpotifyAuthService } from '../spotify-auth.service'
Expand Down
4 changes: 3 additions & 1 deletion src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ export * from './filters'
export * from './helpers'
export * from './interceptors'
export * from './mock'
export * from './testing'

// Do not include testing in export, auto imports testing modules
// export * from './testing'
3 changes: 2 additions & 1 deletion src/utils/testing/mocking.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { jest } from '@jest/globals'
import { CACHE_MANAGER } from '@nestjs/cache-manager'
import { Repository } from 'typeorm'

export type MockType<T> = {
[P in keyof T]?: jest.Mock<object>
[P in keyof T]?: jest.Mock<any>
}

export const mockCache = {
Expand Down

0 comments on commit 93c6efb

Please sign in to comment.