Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

psp-7082 ensure that primary contact logic for org teams works when t… #3556

Merged
merged 1 commit into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { AcquisitionTeamFormModel } from './models';

describe('acquisition model tests', () => {
it('omits the primary contact if unset', () => {
let model = new AcquisitionTeamFormModel('testType');
model.primaryContactId = '';
expect(model.toApi(1)?.primaryContactId).toBeUndefined();
});

it('omits the primary contact if null', () => {
let model = new AcquisitionTeamFormModel('testType');
model.primaryContactId = null as any;
expect(model.toApi(1)?.primaryContactId).toBeUndefined();
});

it('omits the primary contact if undefined', () => {
let model = new AcquisitionTeamFormModel('testType');
model.primaryContactId = undefined as any;
expect(model.toApi(1)?.primaryContactId).toBeUndefined();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class AcquisitionTeamFormModel {
person: undefined,
organizationId: organizationId ?? undefined,
organization: undefined,
primaryContactId: this.primaryContactId !== '' ? Number(this.primaryContactId) : undefined,
primaryContactId: !isNaN(+this.primaryContactId) ? Number(this.primaryContactId) : undefined,
teamProfileType: toTypeCode(this.contactTypeCode),
teamProfileTypeCode: this.contactTypeCode,
};
Expand Down
Loading