feat: add Ref city hover details to public maps
This commit is contained in:
@@ -1,8 +1,14 @@
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
|
||||
import { loadRegionDisplayMapByName } from '../src/maps/mapDefinition.js';
|
||||
import { loadMapLayout } from '../src/maps/mapLayout.js';
|
||||
|
||||
describe('map layout resource adapter', () => {
|
||||
it('loads the Ref theme region labels from the shared resource', async () => {
|
||||
await expect(loadRegionDisplayMapByName('che')).resolves.toMatchObject({ 1: '하북', 8: '동이' });
|
||||
await expect(loadRegionDisplayMapByName('chess')).resolves.toMatchObject({ 1: '킹', 7: '빈칸' });
|
||||
});
|
||||
|
||||
it('resolves the scenario map through the shared runtime loaders', async () => {
|
||||
const loadScenario = vi.fn().mockResolvedValue({
|
||||
config: { environment: { mapName: 'custom-map' } },
|
||||
@@ -20,7 +26,9 @@ describe('map layout resource adapter', () => {
|
||||
],
|
||||
});
|
||||
|
||||
await expect(loadMapLayout('scenario_2601.json', { loadScenario, loadMap })).resolves.toEqual({
|
||||
const loadRegionMap = vi.fn().mockResolvedValue({ 2: '테스트권역' });
|
||||
|
||||
await expect(loadMapLayout('scenario_2601.json', { loadScenario, loadMap, loadRegionMap })).resolves.toEqual({
|
||||
mapName: 'custom-map',
|
||||
cityList: [
|
||||
{
|
||||
@@ -33,11 +41,12 @@ describe('map layout resource adapter', () => {
|
||||
path: [8],
|
||||
},
|
||||
],
|
||||
regionMap: {},
|
||||
levelMap: {},
|
||||
regionMap: { 2: '테스트권역' },
|
||||
levelMap: { 1: '수', 2: '진', 3: '관', 4: '이', 5: '소', 6: '중', 7: '대', 8: '특' },
|
||||
});
|
||||
expect(loadScenario).toHaveBeenCalledWith(2601);
|
||||
expect(loadMap).toHaveBeenCalledWith('custom-map');
|
||||
expect(loadRegionMap).toHaveBeenCalledWith('custom-map');
|
||||
});
|
||||
|
||||
it('retains the che fallback for unknown preserved scenarios', async () => {
|
||||
@@ -47,6 +56,7 @@ describe('map layout resource adapter', () => {
|
||||
loadMapLayout('custom-runtime', {
|
||||
loadScenario: vi.fn(),
|
||||
loadMap,
|
||||
loadRegionMap: vi.fn().mockResolvedValue({}),
|
||||
})
|
||||
).resolves.toMatchObject({ mapName: 'che' });
|
||||
expect(loadMap).toHaveBeenCalledWith('che');
|
||||
|
||||
Reference in New Issue
Block a user