Some checks failed
CI / Lint (pull_request) Has been cancelled
CI / Schema map up to date (pull_request) Has been cancelled
CI / Forbidden patterns (9 checks) (pull_request) Has been cancelled
CI / Migrations apply (node-pg-migrate) (pull_request) Has been cancelled
CI / Unit tests (vitest) (pull_request) Has been cancelled
Convoy metrics gate / Require role-event telemetry on convoy PRs (pull_request) Has been cancelled
PR Health rollup / Aggregate gate status (pull_request) Has been cancelled
Preview smoke / Should run? (pull_request) Has been cancelled
Preview smoke / Playwright smoke (pull_request) Has been cancelled
- lib/card-import/lorcana-bulk.js: Lorcast per-card pricing via api.lorcast.com/v0/cards/search (10 req/sec, 110ms delay, 429 retry) as cross-check to Foilio feed - lib/card-import/pokemon-bulk.js: TCGdex pricing (already wired via lib/pricing/tcgdex-client.js) - test/lib/card-import-lorcana-bulk.test.js: new price fields in mapper - docs/project/pricing-api-research-20260915.md: final verified source matrix - docs/DOKPLOY_DEPLOY.md: pricing API env vars
69 lines
2.2 KiB
JavaScript
69 lines
2.2 KiB
JavaScript
import { describe, expect, it } from 'vitest';
|
|
|
|
import { mapLorcanaCard } from '../../lib/card-import/lorcana-bulk.js';
|
|
|
|
describe('mapLorcanaCard', () => {
|
|
it('maps Lorcana bulk API fields to cards table shape', () => {
|
|
const mapped = mapLorcanaCard({
|
|
Unique_ID: 'TFC-001',
|
|
Name: 'Ariel - On Human Legs',
|
|
Set_Name: 'The First Chapter',
|
|
Set_ID: 'TFC',
|
|
Card_Num: 1,
|
|
Rarity: 'Uncommon',
|
|
Cost: 4,
|
|
Type: 'Character',
|
|
Color: 'Amber, Sapphire',
|
|
Classifications: 'Storyborn, Hero',
|
|
Body_Text: 'Voiceless: This character cannot {e} to sing songs.',
|
|
Strength: 3,
|
|
Willpower: 4,
|
|
Image: 'https://lorcana-api.com/images/ariel/on_human_legs/ariel-on_human_legs-large.png',
|
|
Artist: 'Koni',
|
|
Flavor_Text: '...',
|
|
Lore: 2,
|
|
Inkable: true,
|
|
Abilities: 'Shift 3',
|
|
});
|
|
|
|
expect(mapped).toEqual({
|
|
scryfallId: 'TFC-001',
|
|
name: 'Ariel - On Human Legs',
|
|
setName: 'The First Chapter',
|
|
setCode: 'TFC',
|
|
cardNumber: '1',
|
|
rarity: 'Uncommon',
|
|
manaCost: '4',
|
|
cmc: 4,
|
|
cardType: 'Character',
|
|
colors: JSON.stringify(['Amber', 'Sapphire']),
|
|
colorIdentity: JSON.stringify(['Amber', 'Sapphire']),
|
|
oracleText: 'Voiceless: This character cannot {e} to sing songs.',
|
|
power: '3',
|
|
toughness: '4',
|
|
imageUrl: 'https://lorcana-api.com/images/ariel/on_human_legs/ariel-on_human_legs-large.png',
|
|
stockImageUrl: 'https://lorcana-api.com/images/ariel/on_human_legs/ariel-on_human_legs-large.png',
|
|
flavorText: '...',
|
|
artist: 'Koni',
|
|
edhrecRank: 2,
|
|
keywords: JSON.stringify(['Storyborn', 'Hero', 'Shift 3', 'Inkable']),
|
|
tcgplayerId: null,
|
|
currentPrice: null,
|
|
marketPrice: null,
|
|
});
|
|
});
|
|
|
|
it('omits Inkable keyword when card is not inkable', () => {
|
|
const mapped = mapLorcanaCard({
|
|
Unique_ID: 'ARI-001',
|
|
Name: 'Rhino - Motivational Speaker',
|
|
Set_Name: 'Archazia\'s Island',
|
|
Set_ID: 'ARI',
|
|
Card_Num: 1,
|
|
Inkable: false,
|
|
Classifications: 'Storyborn, Ally',
|
|
});
|
|
|
|
expect(JSON.parse(mapped.keywords)).toEqual(['Storyborn', 'Ally']);
|
|
});
|
|
});
|