Skip to content

Commit

Permalink
Implements location detail parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
coconutcraig committed Nov 17, 2018
1 parent 14802ff commit c0bf907
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/models/attendee.test.ts
Expand Up @@ -22,3 +22,22 @@ it('can set answers when providing multiple answers', async () => {
})
);
});

it('can set location detail parameters and maintain existing attributes', async () => {
const attendee = new Attendee;
const details = {
address: '123 Fake St',
city: 'Fake City',
country: 'FC',
postcode: 'X0X 0X0',
region: 'FR',
timezone: 'UTC',
};

expect(attendee.located(details).getAttributes()).toEqual(
expect.objectContaining({
...attendee.getAttributes(),
...details
})
);
});
2 changes: 2 additions & 0 deletions src/models/attendee.ts
Expand Up @@ -22,6 +22,8 @@ export default class Attendee extends Model implements AttendeeModel {
}

public located(details: LocationDetailParameters): this {
this.attributes = {...this.attributes, ...details};

return this;
}

Expand Down

0 comments on commit c0bf907

Please sign in to comment.