mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-18 21:16:47 +00:00
feat(map): amap as map api provider and display template
This commit is contained in:
@@ -143,6 +143,10 @@ export function buildAdminHook(overrides: Record<string, unknown> = {}): AdminHo
|
||||
setWeatherKey: vi.fn(),
|
||||
unsplashKey: '',
|
||||
setUnsplashKey: vi.fn(),
|
||||
amapKey: '',
|
||||
setAmapKey: vi.fn(),
|
||||
placesProvider: 'auto',
|
||||
savingPlacesProvider: false,
|
||||
showKeys: {},
|
||||
setShowKeys: vi.fn(),
|
||||
savingKeys: false,
|
||||
@@ -169,6 +173,7 @@ export function buildAdminHook(overrides: Record<string, unknown> = {}): AdminHo
|
||||
handleSaveApiKeys: vi.fn(),
|
||||
handleValidateKeys: vi.fn(),
|
||||
handleValidateKey: vi.fn(),
|
||||
handleSavePlacesProvider: vi.fn(),
|
||||
handleCreateUser: vi.fn(),
|
||||
handleCreateInvite: vi.fn(),
|
||||
handleDeleteInvite: vi.fn(),
|
||||
|
||||
@@ -250,12 +250,18 @@ describe('MAdminSettingsSection', () => {
|
||||
const user = userEvent.setup();
|
||||
const admin = renderSettings();
|
||||
|
||||
await user.type(screen.getAllByPlaceholderText('Enter key...')[0], 'm');
|
||||
// By accessible name rather than by position: the card gained an Amap field
|
||||
// between Maps and Unsplash, and an index quietly starts asserting about a
|
||||
// different input when that happens.
|
||||
await user.type(screen.getByLabelText('Google Maps API Key'), 'm');
|
||||
expect(admin.setMapsKey).toHaveBeenCalledWith('m');
|
||||
|
||||
await user.type(screen.getAllByPlaceholderText('Enter key...')[1], 'u');
|
||||
await user.type(screen.getByLabelText('Unsplash API Key'), 'u');
|
||||
expect(admin.setUnsplashKey).toHaveBeenCalledWith('u');
|
||||
|
||||
await user.type(screen.getByLabelText(/Amap/), 'a');
|
||||
expect(admin.setAmapKey).toHaveBeenCalledWith('a');
|
||||
|
||||
await user.click(screen.getAllByRole('button', { name: 'Save' })[2]);
|
||||
expect(admin.handleSaveApiKeys).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user