Skip to content

Commit ef30923

Browse files
committed
More testing of PointOfInterest.
1 parent b15ff91 commit ef30923

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

Diff for: javascript/model/pointOfInterest.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@ export default class PointOfInterest {
1919
this.coordinate = new Coordinate(poiDef.get('coord'))
2020
this.chatLink = poiDef.get('chat_link')
2121
this.iconUrl = iconUrls.get(`map_${this.type}`)
22-
}
23-
24-
get _iconScale() {
25-
return iconScales.get(this.type, 1)
22+
this._iconScale = iconScales.get(this.type, 1)
2623
}
2724

2825
get olFeature() {

Diff for: test/model/pointOfInterest-spec.js

+13-4
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,29 @@ describe('A point of interest', function() {
3939
expect(coordinateSpy).to.have.been.calledWith(poiDef.get('coord'))
4040
expect(poi.chatLink).to.equal('[chatLink]')
4141
expect(poi.iconUrl).to.equal('waypointUrl')
42+
expect(poi._iconScale).to.equal(0.5)
4243
})
4344

4445
it('should get type poi if given type landmark', function() {
45-
let landmarkDef = poiDef.set('type', 'landmark')
46-
let poi = new PointOfInterest(landmarkDef, iconUrls, coordinateSpy)
46+
const landmarkDef = poiDef.set('type', 'landmark')
47+
const poi = new PointOfInterest(landmarkDef, iconUrls, coordinateSpy)
4748
expect(poi.type).to.equal('poi')
4849
expect(poi.iconUrl).to.equal('poiUrl')
50+
expect(poi._iconScale).to.equal(0.75)
4951
})
5052

5153
it('should get type dungeon if given type unlock', function() {
52-
let unlockDef = poiDef.set('type', 'unlock')
53-
let dungeon = new PointOfInterest(unlockDef, iconUrls, coordinateSpy)
54+
const unlockDef = poiDef.set('type', 'unlock')
55+
const dungeon = new PointOfInterest(unlockDef, iconUrls, coordinateSpy)
5456
expect(dungeon.type).to.equal('dungeon')
5557
expect(dungeon.iconUrl).to.equal('dungeonUrl')
58+
expect(dungeon._iconScale).to.equal(1)
59+
})
60+
})
61+
62+
describe('#olFeature', function() {
63+
it('should return an ol.Feature', function() {
64+
expect(poi.olFeature).to.be.an.instanceOf(ol.Feature)
5665
})
5766
})
5867
})

0 commit comments

Comments
 (0)