Skip to content

Commit

Permalink
update geo
Browse files Browse the repository at this point in the history
  • Loading branch information
adamgibbons committed Oct 1, 2017
1 parent 6f596f4 commit 82afc59
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const event = {
description: 'Annual 10-kilometer run in Boulder, Colorado',
location: 'Folsom Field, University of Colorado (finish line)',
url: 'http://www.bolderboulder.com/',
geolocation: { lat: 40.0095, lon: 105.2669 },
geo: { lat: 40.0095, lon: 105.2669 },
categories: ['10k races', 'Memorial Day Weekend', 'Boulder CO'],
status: 'CONFIRMED',
organizer: [{ name: 'Admin', email: '[email protected]' }],
Expand Down Expand Up @@ -105,7 +105,7 @@ The following properties are accepted:
| title | Title of event. | `'Code review'`
| description | Description of event. | `'A constructive roasting of those seeking to merge into master branch'`
| location | Intended venue | `Mountain Sun Pub and Brewery`.
| geolocation | Geographic coordinates (lat/lon) | `{ lat: 38.9072, lon: 77.0369 }`
| geo | Geographic coordinates (lat/lon) | `{ lat: 38.9072, lon: 77.0369 }`
| url | URL associated with event | `'http://www.mountainsunpub.com/'`
| status | Three statuses are allowed: `tentative`, `confirmed`, or `cancelled` | `confirmed`
| organizer | Person organizing the event | `{name: 'Adam Gibbons', email: '[email protected]'}`
Expand Down
2 changes: 1 addition & 1 deletion src/schema/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const schema = Joi.object().keys({
end: dateTimeSchema,
description: Joi.string(),
url: Joi.string().uri(),
geolocation: Joi.object().keys({ lat: Joi.number(), lon: Joi.number() }),
geo: Joi.object().keys({ lat: Joi.number(), lon: Joi.number() }),
location: Joi.string(),
status: Joi.string().regex(/TENTATIVE|CANCELLED|CONFIRMED/),
categories: Joi.array().items(Joi.string()),
Expand Down
8 changes: 4 additions & 4 deletions test/schema/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ describe('.validateEvent', () => {
title: 'foo',
uid: 'foo',
start: [2018, 12, 1, 10, 30],
geolocation: 'abc'
}).error.details.some(p => p.message === '"geolocation" must be an object')).to.be.true
geo: 'abc'
}).error.details.some(p => p.message === '"geo" must be an object')).to.be.true

expect(validateEvent({
title: 'foo',
uid: 'foo',
start: [2018, 12, 1, 10, 30],
geolocation: { lat: 'thing', lon: 32.1 },
}).error.details.some(p => p.path === 'geolocation.lat')).to.be.true
geo: { lat: 'thing', lon: 32.1 },
}).error.details.some(p => p.path === 'geo.lat')).to.be.true

expect(validateEvent({
title: 'foo',
Expand Down

0 comments on commit 82afc59

Please sign in to comment.