Skip to content

Commit

Permalink
chore: run prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
crookedneighbor committed Oct 26, 2024
1 parent 4923eb8 commit 16e7e4e
Show file tree
Hide file tree
Showing 13 changed files with 40 additions and 40 deletions.
2 changes: 1 addition & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ export default tseslint.config(
rules: {
...vitest.configs.recommended.rules, // you can also use vitest.configs.all.rules to enable all rules
},
}
},
);
2 changes: 1 addition & 1 deletion scripts/download-symbology-fixture.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default ${JSON.stringify(symbols, null, 2)} as Record<string, string>`;
if (existingModule !== module) {
fs.writeFileSync(pathToFixture, module, "utf8");
console.error(
"New symbology data downloaded. Symbology fixture updated. Aborting pre-publish task so the new file can be committed."
"New symbology data downloaded. Symbology fixture updated. Aborting pre-publish task so the new file can be committed.",
);
process.exit(1);
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/api-request/send-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function makeRequest({ url, method, body }: RequestOptions) {
}

export default async function sendRequest(
options: RequestOptions
options: RequestOptions,
): Promise<ApiResponse> {
const response = await makeRequest(options);

Expand Down
2 changes: 1 addition & 1 deletion test/unit/api-routes/cards.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ describe("/cards", () => {
() => {
expect(get).toBeCalledTimes(1);
expect(get).toBeCalledWith("/cards/foo/123a/es");
}
},
);
});
});
Expand Down
8 changes: 4 additions & 4 deletions test/unit/lib/api-request/get-url.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ describe("getUrl", () => {

it("noops when url already has domain", () => {
expect(getUrl("https://api.scryfall.com/foo")).toBe(
"https://api.scryfall.com/foo"
"https://api.scryfall.com/foo",
);
});

it("adds query param", () => {
expect(
getUrl("/foo", {
q: "foo",
})
}),
).toBe("https://api.scryfall.com/foo?q=foo");
});

Expand All @@ -28,7 +28,7 @@ describe("getUrl", () => {
getUrl("/foo", {
q: "foo",
x: "bar",
})
}),
).toBe("https://api.scryfall.com/foo?q=foo&x=bar");
});

Expand All @@ -37,7 +37,7 @@ describe("getUrl", () => {
getUrl("/foo?a=baz", {
q: "foo",
x: "bar",
})
}),
).toBe("https://api.scryfall.com/foo?a=baz&q=foo&x=bar");
});
});
8 changes: 4 additions & 4 deletions test/unit/lib/api-request/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe("request", () => {
expect.objectContaining({
endpoint: "foo",
method: "get",
})
}),
);
});
});
Expand All @@ -33,7 +33,7 @@ describe("request", () => {
query: {
q: "bar",
},
})
}),
);
});
});
Expand All @@ -47,7 +47,7 @@ describe("request", () => {
expect.objectContaining({
endpoint: "foo",
method: "post",
})
}),
);
});
});
Expand All @@ -64,7 +64,7 @@ describe("request", () => {
body: {
post: "bar",
},
})
}),
);
});
});
Expand Down
4 changes: 2 additions & 2 deletions test/unit/lib/api-request/send-request-to-api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ describe("apiRequest", () => {
}).catch((e) => {
expect(e).toBeInstanceOf(ScryfallError);
expect(e.message).toBe(
"An unexpected error occurred when requesting resources from Scryfall."
"An unexpected error occurred when requesting resources from Scryfall.",
);
expect(e.status).toBe(500);
expect(e.originalError).toBe(err);
Expand All @@ -149,7 +149,7 @@ describe("apiRequest", () => {
}).catch((e) => {
expect(e).toBeInstanceOf(ScryfallError);
expect(e.message).toBe(
"Something went wrong when wrapping the response from Scryfall"
"Something went wrong when wrapping the response from Scryfall",
);
expect(e.thrownError).toBe(err);
});
Expand Down
4 changes: 2 additions & 2 deletions test/unit/lib/api-request/send-request.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ describe("sendRequest", () => {
sendRequest({
method: "get",
url: "https://example.com",
})
}),
).rejects.toBeInstanceOf(ScryfallError);
await expect(
sendRequest({
method: "get",
url: "https://example.com",
})
}),
).rejects.toMatchObject({
message: "Error from API",
});
Expand Down
2 changes: 1 addition & 1 deletion test/unit/lib/wrap-scryfall-response.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ describe("wrapScryfallResponse", function () {
expect(wrappedResponse).toBeInstanceOf(Card);
expect(wrappedResponse.image_uris.small).toContain("scryfall");
expect(wrappedResponse.all_parts[0]).toBeInstanceOf(
GenericScryfallResponse
GenericScryfallResponse,
);
});

Expand Down
38 changes: 19 additions & 19 deletions test/unit/models/card.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe("Card", function () {
const cardWithoutFaces = new Card(cardFixture);
const cardWithFaces = new Card(cardWithTransformLayoutFixture);
const cardWithFlavorNameOnMultipleFaces = new Card(
cardWithFlavorNameOnMultipleFacesFixture
cardWithFlavorNameOnMultipleFacesFixture,
);

expect(cardWithoutFaces.card_faces).not.toBe(cardFixture.card_faces);
Expand All @@ -54,13 +54,13 @@ describe("Card", function () {

expect(cardWithFaces.card_faces.length).toBe(2);
expect(cardWithFaces.card_faces).toBe(
cardWithTransformLayoutFixture.card_faces
cardWithTransformLayoutFixture.card_faces,
);

expect(cardWithFlavorNameOnMultipleFaces.flavor_name).toBe(
cardWithFlavorNameOnMultipleFacesFixture.card_faces[0].flavor_name +
" // " +
cardWithFlavorNameOnMultipleFaces.card_faces[1].flavor_name
cardWithFlavorNameOnMultipleFaces.card_faces[1].flavor_name,
);
});

Expand Down Expand Up @@ -169,7 +169,7 @@ describe("Card", function () {
const img = card.getImage();
expect(typeof img).toBe("string");
expect(img).toBe(
cardWithTransformLayoutFixture.card_faces[0].image_uris.normal
cardWithTransformLayoutFixture.card_faces[0].image_uris.normal,
);
});

Expand Down Expand Up @@ -230,7 +230,7 @@ describe("Card", function () {
expect(() => {
card.getBackImage();
}).toThrowError(
"An unexpected error occured when attempting to show back side of card."
"An unexpected error occured when attempting to show back side of card.",
);

card.card_faces[1].image_uris = oldImageUris;
Expand All @@ -241,7 +241,7 @@ describe("Card", function () {

const img = card.getBackImage();
expect(img).toBe(
cardWithTransformLayoutFixture.card_faces[1].image_uris.normal
cardWithTransformLayoutFixture.card_faces[1].image_uris.normal,
);
});

Expand All @@ -250,7 +250,7 @@ describe("Card", function () {

const img = card.getBackImage("small");
expect(img).toBe(
cardWithTransformLayoutFixture.card_faces[1].image_uris.small
cardWithTransformLayoutFixture.card_faces[1].image_uris.small,
);
});

Expand Down Expand Up @@ -348,13 +348,13 @@ describe("Card", function () {
describe("getTokens", function () {
beforeEach(function () {
fakeRequest.mockResolvedValueOnce(
wrapScryfallResponse(tokensFixture.elephant)
wrapScryfallResponse(tokensFixture.elephant),
);
fakeRequest.mockResolvedValueOnce(
wrapScryfallResponse(tokensFixture.wolf)
wrapScryfallResponse(tokensFixture.wolf),
);
fakeRequest.mockResolvedValueOnce(
wrapScryfallResponse(tokensFixture.snake)
wrapScryfallResponse(tokensFixture.snake),
);
});

Expand All @@ -364,13 +364,13 @@ describe("Card", function () {
return card.getTokens().then((tokens: Card[]) => {
expect(get).toBeCalledTimes(3);
expect(get).toBeCalledWith(
"https://api.scryfall.com/cards/2dbccfc7-427b-41e6-b770-92d73994bf3b"
"https://api.scryfall.com/cards/2dbccfc7-427b-41e6-b770-92d73994bf3b",
);
expect(get).toBeCalledWith(
"https://api.scryfall.com/cards/2a452235-cebd-4e8f-b217-9b55fc1c3830"
"https://api.scryfall.com/cards/2a452235-cebd-4e8f-b217-9b55fc1c3830",
);
expect(get).toBeCalledWith(
"https://api.scryfall.com/cards/7bdb3368-fee3-4795-a23f-c97555ee7475"
"https://api.scryfall.com/cards/7bdb3368-fee3-4795-a23f-c97555ee7475",
);

tokens.forEach((token: Card) => {
Expand All @@ -390,29 +390,29 @@ describe("Card", function () {

it("looks up tokens from prints for card when card has no `all_parts` attribute, but rules text mentions token", function () {
const list = wrapScryfallResponse(
listOfPrintsWithAndWithoutTokensFixture
listOfPrintsWithAndWithoutTokensFixture,
) as List<Card>;
const card = list.find((c) => !c.all_parts);

vi.spyOn(card, "getPrints").mockResolvedValue(
wrapScryfallResponse({
object: "list",
data: [cardWithTokenButNoPartsFixture, cardWithMultipleTokensFixture],
})
}),
);

return card.getTokens().then((tokens: Card[]) => {
expect(card.getPrints).toBeCalledTimes(1);

expect(get).toBeCalledTimes(3);
expect(get).toBeCalledWith(
"https://api.scryfall.com/cards/2dbccfc7-427b-41e6-b770-92d73994bf3b"
"https://api.scryfall.com/cards/2dbccfc7-427b-41e6-b770-92d73994bf3b",
);
expect(get).toBeCalledWith(
"https://api.scryfall.com/cards/2a452235-cebd-4e8f-b217-9b55fc1c3830"
"https://api.scryfall.com/cards/2a452235-cebd-4e8f-b217-9b55fc1c3830",
);
expect(get).toBeCalledWith(
"https://api.scryfall.com/cards/7bdb3368-fee3-4795-a23f-c97555ee7475"
"https://api.scryfall.com/cards/7bdb3368-fee3-4795-a23f-c97555ee7475",
);

tokens.forEach((token: Card) => {
Expand All @@ -424,7 +424,7 @@ describe("Card", function () {

it("resolves with empty array when rules text mentions tokens but no prints have them", function () {
const list = wrapScryfallResponse(
listOfPrintsWithTokensButNoPartsFixture
listOfPrintsWithTokensButNoPartsFixture,
);
const card = list[0];

Expand Down
4 changes: 2 additions & 2 deletions test/unit/models/catalog.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ describe("Catalog", function () {
expect(upperCaseNames).toBeInstanceOf(Array);
expect(upperCaseNames).not.toBeInstanceOf(Catalog);
expect(upperCaseNames[0]).toBe(
catalogOfCardNamesFixture.data[0].toUpperCase()
catalogOfCardNamesFixture.data[0].toUpperCase(),
);
expect(upperCaseNames[1]).toBe(
catalogOfCardNamesFixture.data[1].toUpperCase()
catalogOfCardNamesFixture.data[1].toUpperCase(),
);
});

Expand Down
2 changes: 1 addition & 1 deletion test/unit/models/list.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe("List", function () {
describe("next", function () {
beforeEach(function () {
fakeRequest.mockResolvedValue(
wrapScryfallResponse(listOfCardsPage2Fixture)
wrapScryfallResponse(listOfCardsPage2Fixture),
);
});

Expand Down
2 changes: 1 addition & 1 deletion test/unit/models/scryfall-error.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe("ScryfallError", function () {
expect(error.code).toBe("not_found");
expect(error.status).toBe(404);
expect(error.details).toBe(
"Too many cards match ambiguous name “jace”. Add more words to refine your search."
"Too many cards match ambiguous name “jace”. Add more words to refine your search.",
);
expect(error.type).toBe("ambiguous");
});
Expand Down

0 comments on commit 16e7e4e

Please sign in to comment.