mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 01:02:58 +00:00
Fix code tests for bbbf401232
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user