Skip to content

Commit

Permalink
fix: type on trackgroup tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon committed Aug 14, 2024
1 parent 0c1e19e commit db1fe6c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 16 deletions.
9 changes: 1 addition & 8 deletions test/routers/admin/tasks.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,7 @@ import * as dotenv from "dotenv";
dotenv.config();
import { describe, it } from "mocha";
import request from "supertest";
import {
clearTables,
createArtist,
createTrackGroup,
createUser,
} from "../../utils";
import prisma from "@mirlo/prisma";
import { randomUUID } from "crypto";
import { clearTables, createUser } from "../../utils";

const baseURL = `${process.env.API_DOMAIN}/v1/`;

Expand Down
2 changes: 1 addition & 1 deletion test/routers/manage/artists/{id}.trackgroups.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe("manage/artists/{artistId}/trackGroups", () => {
const { user, accessToken } = await createUser({ email: "test@testcom" });
const artist = await createArtist(user.id);
await createTrackGroup(artist.id, {
tracks: [] as Prisma.TrackCreateNestedManyWithoutTrackGroupInput,
tracks: [],
});
const response = await requestApp
.get(`manage/artists/${artist.id}/trackGroups`)
Expand Down
8 changes: 4 additions & 4 deletions test/routers/trackGroups/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe("trackGroups", () => {
const { user } = await createUser({ email: "test@testcom" });
const artist = await createArtist(user.id);
await createTrackGroup(artist.id, {
tracks: [] as Prisma.TrackCreateNestedManyWithoutTrackGroupInput,
tracks: [],
});
const response = await requestApp
.get("trackGroups")
Expand Down Expand Up @@ -103,14 +103,14 @@ describe("trackGroups", () => {
it("should limit to one by artist on distinctArtists", async () => {
const { user } = await createUser({ email: "test@testcom" });
const artist = await createArtist(user.id);
const mostRecent = await createTrackGroup(artist.id, {
await createTrackGroup(artist.id, {
title: "most recent",
});
const middle = await createTrackGroup(artist.id, {
await createTrackGroup(artist.id, {
title: "middle",
urlSlug: "a-second-album",
});
const oldest = await createTrackGroup(artist.id, {
await createTrackGroup(artist.id, {
title: "oldest",
urlSlug: "a-oldest-album",
});
Expand Down
4 changes: 2 additions & 2 deletions test/routers/trackGroups/{id}.redeemCode.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ describe("trackGroups/{id}/redeemCode", () => {
const artist = await createArtist(user.id);
const trackGroup = await createTrackGroup(artist.id);

const { user: purchaser } = await createUser({
await createUser({
email: "[email protected]",
});

const code = await prisma.trackGroupDownloadCodes.create({
await prisma.trackGroupDownloadCodes.create({
data: {
trackGroupId: trackGroup.id,
downloadCode: "asdf",
Expand Down
4 changes: 3 additions & 1 deletion test/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ export const createTier = async (

export const createTrackGroup = async (
artistId: number,
data?: Partial<Prisma.TrackGroupCreateArgs["data"]>
data?: Partial<Prisma.TrackGroupCreateArgs["data"]> & {
tracks?: { title: string }[];
}
) => {
const tg = await prisma.trackGroup.create({
data: {
Expand Down

0 comments on commit db1fe6c

Please sign in to comment.