adjust tests for new rate limit handling

see 91aa85a1c
This commit is contained in:
Martin Raifer
2025-03-11 16:00:09 +01:00
parent 49e895e2ed
commit a33c340356

View File

@@ -164,7 +164,7 @@ describe('iD.serviceOsm', function () {
});
it('dispatches change event if 509 Bandwidth Limit Exceeded', async () => {
fetchMock.mock('https://www.openstreetmap.org' + path, {
fetchMock.mock(`https://www.openstreetmap.org${path}?bbox=`, {
body: 'Bandwidth Limit Exceeded',
status: 509,
headers: { 'Content-Type': 'text/plain' }
@@ -172,7 +172,7 @@ describe('iD.serviceOsm', function () {
logout();
connection.on('change', spy);
const promise = promisify(connection.loadFromAPI).call(connection, path);
const promise = promisify(connection.loadTile).call(connection, { id: '0', extent: { toParam: () => '', bbox: () => ({}) } });
await expect(promise).rejects.toThrow(expect.objectContaining({ status: 509 }));
@@ -180,7 +180,7 @@ describe('iD.serviceOsm', function () {
});
it('dispatches change event if 429 Too Many Requests', async () => {
fetchMock.mock('https://www.openstreetmap.org' + path, {
fetchMock.mock(`https://www.openstreetmap.org${path}?bbox=`, {
body: '429 Too Many Requests',
status: 429,
headers: { 'Content-Type': 'text/plain' }
@@ -188,7 +188,7 @@ describe('iD.serviceOsm', function () {
logout();
connection.on('change', spy);
const promise = promisify(connection.loadFromAPI).call(connection, path);
const promise = promisify(connection.loadTile).call(connection, { id: '0', extent: { toParam: () => '', bbox: () => ({}) } });
await expect(promise).rejects.toThrow(expect.objectContaining({ status: 429 }));
expect(spy).to.have.been.calledOnce;