Skip to content

Commit

Permalink
Ensures attendees messageable attribute can be set to false
Browse files Browse the repository at this point in the history
  • Loading branch information
coconutcraig committed Jul 8, 2019
1 parent 634ff3d commit d7cbf01
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
10 changes: 10 additions & 0 deletions src/models/attendee.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ it('can set that an attendee is messagable', async () => {
);
});

it('can set that an attendee is not messagable', async () => {
const attendee = new Attendee();

expect(attendee.messagable(false).getAttributes()).toEqual(
expect.objectContaining({
messagable: false,
}),
);
});

it('can set an attendees first and last name', async () => {
const attendee = new Attendee();

Expand Down
6 changes: 3 additions & 3 deletions src/models/attendee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export interface AttendeeModel extends ModelInterface {

located(details: LocatableDetailParameters): this;

messagable(): this;
messagable(messageable: boolean): this;

named(first: string, last: string): this;

Expand Down Expand Up @@ -80,8 +80,8 @@ export default class Attendee extends Model implements AttendeeModel {
return this;
}

public messagable(): this {
this.attributes.messagable = true;
public messagable(messageable: boolean = true): this {
this.attributes.messagable = messageable;

return this;
}
Expand Down

0 comments on commit d7cbf01

Please sign in to comment.