feat: Proxy-APIs und Integrationstests für WebServices hinzugefügt
- Vier Proxy-Endpunkte implementiert: 1. gisStationsStatusDistrict 2. gisStationsStaticDistrict 3. gisStationsMeasurements 4. gisSystemStatic - API-Integrationstests mit Jest für alle Endpunkte erstellt: - Tests verwenden echte API-Responses statt Mock-Daten. - Erfolgreiche Anfragen mit gültigen Parametern getestet. - Fehlende Parameter und ungültige Parameter getestet. - Code enthält: - Dynamische URL-Generierung für Proxy-Weiterleitungen. - Prüfung von Headern, Statuscodes und JSON-Strukturen. - Unterstützung für CORS und OPTIONS-Anfragen. - Ergebnis: - Alle Tests erfolgreich bestanden. - APIs bereit für produktive Nutzung und Erweiterungen.
This commit is contained in:
29
__mocks__/gisStationsStatusDistrict.js
Normal file
29
__mocks__/gisStationsStatusDistrict.js
Normal file
@@ -0,0 +1,29 @@
|
||||
const mockXmlData = `
|
||||
<root>
|
||||
<Name>Liste aller Status der Geräte</Name>
|
||||
<Zeitstempel>2025-01-03T11:26:11.777</Zeitstempel>
|
||||
<IdMap>12</IdMap>
|
||||
<Statis>
|
||||
<Item>
|
||||
<IdLD>50922</IdLD>
|
||||
<Na>system</Na>
|
||||
<Le>4</Le>
|
||||
<Co>#FF00FF</Co>
|
||||
<Me>Eingang DE 01 kommend</Me>
|
||||
<Feld>4</Feld>
|
||||
<Icon>0</Icon>
|
||||
</Item>
|
||||
<Item>
|
||||
<IdLD>50922</IdLD>
|
||||
<Na>system</Na>
|
||||
<Le>4</Le>
|
||||
<Co>#FF00FF</Co>
|
||||
<Me>Eingang DE 05 kommend</Me>
|
||||
<Feld>4</Feld>
|
||||
<Icon>0</Icon>
|
||||
</Item>
|
||||
</Statis>
|
||||
</root>
|
||||
`;
|
||||
|
||||
export default mockXmlData;
|
||||
@@ -1,30 +0,0 @@
|
||||
// __mocks__/leaflet.js
|
||||
const L = {
|
||||
map: jest.fn(() => ({
|
||||
setView: jest.fn(),
|
||||
on: jest.fn(),
|
||||
remove: jest.fn(),
|
||||
addLayer: jest.fn(),
|
||||
removeLayer: jest.fn(),
|
||||
})),
|
||||
tileLayer: jest.fn(() => ({
|
||||
addTo: jest.fn(),
|
||||
})),
|
||||
LayerGroup: jest.fn(() => ({
|
||||
addTo: jest.fn(),
|
||||
clearLayers: jest.fn(),
|
||||
addLayer: jest.fn(),
|
||||
})),
|
||||
marker: jest.fn(() => ({
|
||||
addTo: jest.fn(),
|
||||
bindPopup: jest.fn(),
|
||||
on: jest.fn(),
|
||||
})),
|
||||
DivIcon: jest.fn(() => ({
|
||||
className: "",
|
||||
html: "",
|
||||
iconSize: [0, 0],
|
||||
})),
|
||||
};
|
||||
|
||||
export default L;
|
||||
Reference in New Issue
Block a user