Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* Updated card image uri
* Changed compressed_size field to size
  • Loading branch information
furgin committed Jan 15, 2023
1 parent 3ee94da commit 5ac4760
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/IScry.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const ENDPOINT_API = "https://api.scryfall.com";
export const ENDPOINT_FILE_1 = "https://c1.scryfall.com/file";
export const ENDPOINT_FILE_1 = "https://cards.scryfall.io";
export const ENDPOINT_FILE_2 = "https://c2.scryfall.com/file";
export const ENDPOINT_FILE_3 = "https://c3.scryfall.com/file";
export const RESOURCE_GENERIC_CARD_BACK = `${ENDPOINT_FILE_2}/scryfall-errors/missing.jpg` as const;
Expand Down
2 changes: 1 addition & 1 deletion src/api/BulkData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export interface BulkDataDefinition {
uri: string;
name: string;
description: string;
compressed_size: number;
size: number;
download_uri: string;
content_type: string;
content_encoding: string;
Expand Down
22 changes: 11 additions & 11 deletions src/tests/Main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,23 +370,23 @@ describe("Scry", function () {

it("getImageURI", async () => {
let card = await Scry.Cards.byId("d2f3035c-ca27-40f3-ad73-c4e54bb2bcd7");
expect(card.getImageURI("normal")).eq(`${ENDPOINT_FILE_1}/scryfall-cards/normal/front/d/2/d2f3035c-ca27-40f3-ad73-c4e54bb2bcd7.jpg?1549941722`);
expect(card.getImageURI("normal")).eq(`${ENDPOINT_FILE_1}/normal/front/d/2/d2f3035c-ca27-40f3-ad73-c4e54bb2bcd7.jpg?1549941722`);
card = await Scry.Cards.byId("c4ac7570-e74e-4081-ac53-cf41e695b7eb");
expect(card.getImageURI("normal")).eq(`${ENDPOINT_FILE_1}/scryfall-cards/normal/front/c/4/c4ac7570-e74e-4081-ac53-cf41e695b7eb.jpg?1562563598`);
expect(card.getImageURI("normal")).eq(`${ENDPOINT_FILE_1}/normal/front/c/4/c4ac7570-e74e-4081-ac53-cf41e695b7eb.jpg?1562563598`);
});

it("getFrontImageURI", async () => {
let card = await Scry.Cards.byId("d2f3035c-ca27-40f3-ad73-c4e54bb2bcd7");
expect(card.getFrontImageURI("normal")).eq(`${ENDPOINT_FILE_1}/scryfall-cards/normal/front/d/2/d2f3035c-ca27-40f3-ad73-c4e54bb2bcd7.jpg?1549941722`);
expect(card.getFrontImageURI("normal")).eq(`${ENDPOINT_FILE_1}/normal/front/d/2/d2f3035c-ca27-40f3-ad73-c4e54bb2bcd7.jpg?1549941722`);
card = await Scry.Cards.byId("c4ac7570-e74e-4081-ac53-cf41e695b7eb");
expect(card.getFrontImageURI("normal")).eq(`${ENDPOINT_FILE_1}/scryfall-cards/normal/front/c/4/c4ac7570-e74e-4081-ac53-cf41e695b7eb.jpg?1562563598`);
expect(card.getFrontImageURI("normal")).eq(`${ENDPOINT_FILE_1}/normal/front/c/4/c4ac7570-e74e-4081-ac53-cf41e695b7eb.jpg?1562563598`);
});

it("getBackImageURI", async () => {
let card = await Scry.Cards.byId("d2f3035c-ca27-40f3-ad73-c4e54bb2bcd7");
expect(card.getBackImageURI("normal")).eq(RESOURCE_GENERIC_CARD_BACK);
card = await Scry.Cards.byId("c4ac7570-e74e-4081-ac53-cf41e695b7eb");
expect(card.getBackImageURI("normal")).eq(`${ENDPOINT_FILE_1}/scryfall-cards/normal/back/c/4/c4ac7570-e74e-4081-ac53-cf41e695b7eb.jpg?1562563598`);
expect(card.getBackImageURI("normal")).eq(`${ENDPOINT_FILE_1}/normal/back/c/4/c4ac7570-e74e-4081-ac53-cf41e695b7eb.jpg?1562563598`);
});

describe("on faces", () => {
Expand All @@ -411,12 +411,12 @@ describe("Scry", function () {
it("getImageURI", async () => {
let card = await Scry.Cards.byId("d2f3035c-ca27-40f3-ad73-c4e54bb2bcd7");
expect(card.card_faces.length).eq(2);
expect(card.card_faces[0].getImageURI("normal")).eq(`${ENDPOINT_FILE_1}/scryfall-cards/normal/front/d/2/d2f3035c-ca27-40f3-ad73-c4e54bb2bcd7.jpg?1549941722`);
expect(card.card_faces[1].getImageURI("normal")).eq(`${ENDPOINT_FILE_1}/scryfall-cards/normal/front/d/2/d2f3035c-ca27-40f3-ad73-c4e54bb2bcd7.jpg?1549941722`);
expect(card.card_faces[0].getImageURI("normal")).eq(`${ENDPOINT_FILE_1}/normal/front/d/2/d2f3035c-ca27-40f3-ad73-c4e54bb2bcd7.jpg?1549941722`);
expect(card.card_faces[1].getImageURI("normal")).eq(`${ENDPOINT_FILE_1}/normal/front/d/2/d2f3035c-ca27-40f3-ad73-c4e54bb2bcd7.jpg?1549941722`);
card = await Scry.Cards.byId("c4ac7570-e74e-4081-ac53-cf41e695b7eb");
expect(card.card_faces.length).eq(2);
expect(card.card_faces[0].getImageURI("normal")).eq(`${ENDPOINT_FILE_1}/scryfall-cards/normal/front/c/4/c4ac7570-e74e-4081-ac53-cf41e695b7eb.jpg?1562563598`);
expect(card.card_faces[1].getImageURI("normal")).eq(`${ENDPOINT_FILE_1}/scryfall-cards/normal/back/c/4/c4ac7570-e74e-4081-ac53-cf41e695b7eb.jpg?1562563598`);
expect(card.card_faces[0].getImageURI("normal")).eq(`${ENDPOINT_FILE_1}/normal/front/c/4/c4ac7570-e74e-4081-ac53-cf41e695b7eb.jpg?1562563598`);
expect(card.card_faces[1].getImageURI("normal")).eq(`${ENDPOINT_FILE_1}/normal/back/c/4/c4ac7570-e74e-4081-ac53-cf41e695b7eb.jpg?1562563598`);
});
});

Expand Down Expand Up @@ -630,15 +630,15 @@ describe("Scry", function () {
const result = await Scry.BulkData.definitionById(definitions[0].id);

expect(result.object).eq("bulk_data");
expect(result.compressed_size).gte(10000);
expect(result.size).gte(10000);
});

it("by type", async () => {
const result = await Scry.BulkData.definitionByType("all_cards");

expect(result.object).eq("bulk_data");
expect(result.type).eq("all_cards");
expect(result.compressed_size).gte(10000);
expect(result.size).gte(10000);
});
});

Expand Down

0 comments on commit 5ac4760

Please sign in to comment.