Skip to content

Commit

Permalink
fix: update unit tests and mocked data
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcatlait committed Oct 12, 2024
1 parent 6d34d7e commit 6e9f8d6
Show file tree
Hide file tree
Showing 11 changed files with 137 additions and 1,640 deletions.
2 changes: 1 addition & 1 deletion .moon/toolchain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ node:
dedupeOnLockfileChange: false # Currently there is issue with postcss
packageManager: 'npm'
npm:
version: '9'
version: '10'
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ This project is licensed under the MIT License. See the [LICENSE](LICENSE) file
- [x] Set up CI/CD pipeline for automated testing and deployment

### Phase 2: Advanced Streaming and Audio Features
- [ ] Implement MPEG DASH streaming
- [x] Implement MPEG DASH streaming
- [ ] Develop adaptive bitrate streaming
- [x] Add support for various audio formats (FLAC, AAC, OGG, etc.)
- [ ] Implement gapless playback
Expand Down
10 changes: 0 additions & 10 deletions apps/server/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,3 @@ services:
- POSTGRES_DB
ports:
- 5432:5432
volumes:
- db-volume:/var/lib/postgresql/data

volumes:
db-volume:
driver: local
driver_opts:
type: none
o: bind
device: ./data
2 changes: 1 addition & 1 deletion apps/server/integration-tests/tests/tracks.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ describe('Tracks', () => {
expect(response.statusCode).toEqual(200)

const body = JSON.parse(response.body)
expect(body.data.length).toBe(1)
expect(body.data.length).toBe(3)
expect(body.data[0].title).toBe('Bad Romance')
})
})
Expand Down
7 changes: 7 additions & 0 deletions apps/server/moon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,10 @@ tasks:
- 'vitest-integration.config.*'
outputs:
- 'reports/integration'

test:
local: true
deps:
- 'test-unit'
- 'test-contract'
- 'test-integration'
12 changes: 12 additions & 0 deletions apps/server/src/seeds/1000000000030-CreateTracks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ export class CreateTracks1000000000030 implements SeedInterface {
releaseData: new Date(),
artist: 'Lady Gaga',
},
{
title: 'Poker Face',
duration: 214,
releaseData: new Date(),
artist: 'Lady Gaga',
},
{
title: 'Telephone',
duration: 221,
releaseData: new Date(),
artist: 'Lady Gaga',
},
]

async up(queryRunner: QueryRunner): Promise<void> {
Expand Down
6 changes: 3 additions & 3 deletions apps/web/contract-tests/fixtures/track.fixture.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { InteractionObject, MatchersV3 } from '@pact-foundation/pact'
import { InteractionObject, Matcher, MatchersV3 } from '@pact-foundation/pact'

import { PageResponseDto, TrackDto } from '@core/dto'
import { PactMatcher, PactResponses } from 'contract-tests/types'
import { mapTrackDtoToModel } from '@core/mappers'
import { Track } from '@core/models'
import { ArtistRole } from '@core/enum'

const { extractPayload, integer, string, uuid } = MatchersV3

Expand All @@ -22,7 +22,7 @@ const trackDto: PactMatcher<TrackDto> = {
{
id: uuid('c76b4326-ca77-4c24-a414-f002c6be3106'),
name: string('Artist'),
role: string('Main'),
role: string(ArtistRole.Primary) as Matcher<ArtistRole>,
},
],
}
Expand Down
7 changes: 7 additions & 0 deletions apps/web/moon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,10 @@ tasks:
test-integration-ui:
command: 'cypress open'
local: true

test:
local: true
deps:
- 'test-unit'
- 'test-contract'
- 'test-integration'
1 change: 1 addition & 0 deletions apps/web/src/app/core/state/entity.state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export abstract class EntityState<Entity, FetchPayload> implements StateModel<En

fetch(payload: FetchPayload): void {
if (this.cache && this.data()) {
this.status.set(FetchStatus.Success)
return
}

Expand Down
6 changes: 3 additions & 3 deletions contracts/web-music-library-api.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
{
"id": "c76b4326-ca77-4c24-a414-f002c6be3106",
"name": "Artist",
"role": "Main"
"role": "Primary"
}
],
"duration": 123,
Expand Down Expand Up @@ -146,7 +146,7 @@
{
"id": "c76b4326-ca77-4c24-a414-f002c6be3106",
"name": "Artist",
"role": "Main"
"role": "Primary"
}
],
"duration": 123,
Expand Down Expand Up @@ -273,7 +273,7 @@
{
"id": "c76b4326-ca77-4c24-a414-f002c6be3106",
"name": "Artist",
"role": "Main"
"role": "Primary"
}
],
"duration": 123,
Expand Down
Loading

0 comments on commit 6e9f8d6

Please sign in to comment.