Skip to content

Commit

Permalink
test(caa upload): Update Amazon tests
Browse files Browse the repository at this point in the history
The example release has 5 images, but only 4 thumbnails are shown on
amazon.com by default. Using the embedded JavaScript we can extract
larger images whose filenames contain different identifiers.
Additionally we can also detect the type of the front and the back.
  • Loading branch information
kellnerd committed Oct 17, 2021
1 parent 7c0d918 commit d38b85e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions tests/mb_enhanced_cover_art_uploads/providers/amazon.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,14 @@ describe('amazon provider', () => {
`('grabs all images for physical products on $desc', async ({ url }: { url: string }) => {
const covers = await provider.findImages(new URL(url));

expect(covers).toBeArrayOfSize(4);
expect(covers[0].url.pathname).toContain('51nM1ikLWPL');
expect(covers).toBeArrayOfSize(5);
expect(covers[0].url.pathname).toContain('81bqssuW6LL');
expect(covers[0].types).toStrictEqual([ArtworkTypeIDs.Front]);
expect(covers[1].url.pathname).toContain('41RQivjYeeL');
expect(covers[2].url.pathname).toContain('31-n8wloCcL');
expect(covers[3].url.pathname).toMatch(/41MN(?:%2B|\+)eLL(?:%2B|\+)JL/);
expect(covers[1].url.pathname).toContain('61jZYB6BJYL');
expect(covers[1].types).toStrictEqual([ArtworkTypeIDs.Back]);
expect(covers[2].url.pathname).toContain('71TLgC33KgL');
expect(covers[3].url.pathname).toContain('81JCfIAZ71L');
expect(covers[4].url.pathname).toContain('816dglIIJHL');
});

it('returns no covers for product without images', async () => {
Expand Down

0 comments on commit d38b85e

Please sign in to comment.