Fix code tests for bbbf401232

This commit is contained in:
Quincy Morgan
2020-09-24 08:30:19 -04:00
parent bbbf401232
commit 73a826cefc

View File

@@ -24,18 +24,8 @@ describe('iD.serviceOsmWikibase', function () {
return iD.utilStringQs(url.substring(url.indexOf('?')));
}
function adjust(params, data) {
if (params) {
if (params.norm) {
data.description = data.descriptions.fr.value;
data.label = data.labels.fr.value;
}
}
return data;
}
function keyData(params) {
return adjust(params, {
function keyData() {
return {
pageid: 205725,
ns: 120,
title: 'Item:Q42',
@@ -143,11 +133,11 @@ describe('iD.serviceOsmWikibase', function () {
badges: []
}
}
});
};
}
function tagData(params) {
return adjust(params, {
function tagData() {
return {
pageid: 210934,
ns: 120,
title: 'Item:Q13',
@@ -263,7 +253,7 @@ describe('iD.serviceOsmWikibase', function () {
badges: []
}
}
});
};
}
@@ -275,7 +265,7 @@ describe('iD.serviceOsmWikibase', function () {
describe('#getEntity', function () {
it('calls the given callback with the results of the getEntity data item query', function (done) {
var callback = sinon.spy();
wikibase.getEntity({key: 'amenity', value: 'parking', langCode: 'fr'}, callback);
wikibase.getEntity({key: 'amenity', value: 'parking', langCodes: ['fr']}, callback);
server.respondWith('GET', /action=wbgetentities/,
[200, {'Content-Type': 'application/json'}, JSON.stringify({
@@ -302,8 +292,8 @@ describe('iD.serviceOsmWikibase', function () {
}
);
expect(callback).to.have.been.calledWith(null, {
key: keyData({norm: true}),
tag: tagData({norm: true})
key: keyData(),
tag: tagData()
});
done();
}, 50);