Skip to content

Commit

Permalink
Add test case for profile parsing.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredhanson committed Mar 8, 2014
1 parent d35dd03 commit 76882f4
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/data/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"expires_at":"2012-01-25T18:30:08Z","accounts":[{"name":"ACME Corp","href":"https://acmecorp.highrisehq.com","id":333,"product":"highrise"},{"name":"johndoe","href":"https://johndoe.backpackit.com","id":22222,"product":"backpack"},{"name":"ACME Corp","href":"https://acmecorp.basecamphq.com","id":1111111,"product":"basecamp"},{"name":"StealthBus","href":"https://stealthbus.basecamphq.com","id":1221222,"product":"basecamp"}],"identity":{"id":5555,"last_name":"Doe","email_address":"john.doe@example.com","first_name":"John"}}
27 changes: 27 additions & 0 deletions test/profile.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
var fs = require('fs')
, parse = require('../lib/profile').parse;


describe('profile.parse', function() {

describe('example profile', function() {
var profile;

before(function(done) {
fs.readFile('test/data/example.json', 'utf8', function(err, data) {
if (err) { return done(err); }
profile = parse(data);
done();
});
});

it('should parse profile', function() {
expect(profile.id).to.equal('5555');
expect(profile.displayName).to.equal('John Doe');
expect(profile.name.familyName).to.equal('Doe');
expect(profile.name.givenName).to.equal('John');
expect(profile.emails[0].value).to.equal('john.doe@example.com');
});
});

});

0 comments on commit 76882f4

Please sign in to comment.