Skip to content

Commit 997b453

Browse files
committed
Fix code tests for #8276
1 parent 61d0410 commit 997b453

File tree

1 file changed

+39
-20
lines changed

1 file changed

+39
-20
lines changed

test/spec/util/util.js

Lines changed: 39 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -227,29 +227,48 @@ describe('iD.util', function() {
227227
});
228228

229229
describe('utilDisplayName', function() {
230+
before(function() {
231+
iD.fileFetcher.assetPath('dist/');
232+
});
233+
after(function() {
234+
iD.fileFetcher.assetPath('');
235+
});
236+
230237
it('returns the name if tagged with a name', function() {
231238
expect(iD.utilDisplayName({tags: {name: 'East Coast Greenway'}})).to.eql('East Coast Greenway');
232239
});
233-
it('distinguishes unnamed features by ref', function() {
234-
expect(iD.utilDisplayName({tags: {ref: '66'}})).to.eql('66');
235-
});
236-
it('distinguishes unnamed features by network or cycle_network', function() {
237-
expect(iD.utilDisplayName({tags: {network: 'SORTA', ref: '3X'}})).to.eql('SORTA 3X');
238-
expect(iD.utilDisplayName({tags: {network: 'ncn', cycle_network: 'US:US', ref: '76'}})).to.eql('US:US 76');
239-
});
240-
it('distinguishes unnamed routes by direction', function() {
241-
expect(iD.utilDisplayName({tags: {network: 'US:US', ref: '66', direction: 'west'}})).to.eql('US:US 66 west');
242-
// Marguerite X: Counter-Clockwise
243-
expect(iD.utilDisplayName({tags: {network: 'Marguerite', ref: 'X', direction: 'anticlockwise'}})).to.eql('Marguerite X anticlockwise');
244-
});
245-
it('distinguishes unnamed routes by waypoints', function() {
246-
expect(iD.utilDisplayName({tags: {network: 'SORTA', ref: '3X', from: 'Downtown'}})).to.eql('SORTA 3X');
247-
expect(iD.utilDisplayName({tags: {network: 'SORTA', ref: '3X', to: 'Kings Island'}})).to.eql('SORTA 3X');
248-
expect(iD.utilDisplayName({tags: {network: 'SORTA', ref: '3X', via: 'Montgomery'}})).to.eql('SORTA 3X');
249-
// Green Line: Old Ironsides => Winchester
250-
expect(iD.utilDisplayName({tags: {network: 'VTA', ref: 'Green', from: 'Old Ironsides', to: 'Winchester'}})).to.eql('VTA Green from Old Ironsides to Winchester');
251-
// BART Yellow Line: Antioch => Pittsburg/Bay Point => SFO Airport => Millbrae
252-
expect(iD.utilDisplayName({tags: {network: 'BART', ref: 'Yellow', from: 'Antioch', to: 'Millbrae', via: 'Pittsburg/Bay Point;San Francisco International Airport'}})).to.eql('BART Yellow from Antioch to Millbrae via Pittsburg/Bay Point;San Francisco International Airport');
240+
it('distinguishes unnamed features by ref', function(done) {
241+
iD.localizer.loadLocale('en', 'general', 'locales').then(function() {
242+
expect(iD.utilDisplayName({tags: {ref: '66'}})).to.eql('66');
243+
done();
244+
});
245+
});
246+
it('distinguishes unnamed features by network or cycle_network', function(done) {
247+
iD.localizer.loadLocale('en', 'general', 'locales').then(function() {
248+
expect(iD.utilDisplayName({tags: {network: 'SORTA', ref: '3X'}})).to.eql('SORTA 3X');
249+
expect(iD.utilDisplayName({tags: {network: 'ncn', cycle_network: 'US:US', ref: '76'}})).to.eql('US:US 76');
250+
done();
251+
});
252+
});
253+
it('distinguishes unnamed routes by direction', function(done) {
254+
iD.localizer.loadLocale('en', 'general', 'locales').then(function() {
255+
expect(iD.utilDisplayName({tags: {network: 'US:US', ref: '66', direction: 'west', route: 'road'}})).to.eql('US:US 66 west');
256+
// Marguerite X: Counter-Clockwise
257+
expect(iD.utilDisplayName({tags: {network: 'Marguerite', ref: 'X', direction: 'anticlockwise', route: 'bus'}})).to.eql('Marguerite X anticlockwise');
258+
done();
259+
});
260+
});
261+
it('distinguishes unnamed routes by waypoints', function(done) {
262+
iD.localizer.loadLocale('en', 'general', 'locales').then(function() {
263+
expect(iD.utilDisplayName({tags: {network: 'SORTA', ref: '3X', from: 'Downtown', route: 'bus'}})).to.eql('SORTA 3X');
264+
expect(iD.utilDisplayName({tags: {network: 'SORTA', ref: '3X', to: 'Kings Island', route: 'bus'}})).to.eql('SORTA 3X');
265+
expect(iD.utilDisplayName({tags: {network: 'SORTA', ref: '3X', via: 'Montgomery', route: 'bus'}})).to.eql('SORTA 3X');
266+
// Green Line: Old Ironsides => Winchester
267+
expect(iD.utilDisplayName({tags: {network: 'VTA', ref: 'Green', from: 'Old Ironsides', to: 'Winchester', route: 'bus'}})).to.eql('VTA Green from Old Ironsides to Winchester');
268+
// BART Yellow Line: Antioch => Pittsburg/Bay Point => SFO Airport => Millbrae
269+
expect(iD.utilDisplayName({tags: {network: 'BART', ref: 'Yellow', from: 'Antioch', to: 'Millbrae', via: 'Pittsburg/Bay Point;San Francisco International Airport', route: 'subway'}})).to.eql('BART Yellow from Antioch to Millbrae via Pittsburg/Bay Point;San Francisco International Airport');
270+
done();
271+
});
253272
});
254273
});
255274
});

0 commit comments

Comments
 (0)