Skip to content

Commit

Permalink
Merge pull request #398 from sggerard/BCMI-V2
Browse files Browse the repository at this point in the history
Added support for Amalgamated permits
  • Loading branch information
simensma-fresh authored Jun 27, 2024
2 parents 778f54b + edd777a commit 184c0ad
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
13 changes: 12 additions & 1 deletion src/app/models/collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export class Collection {
switch (this.type) {
case 'Permit':
case 'Certificate':
case 'Amalgamated Permit':
case 'Permit Amendment':
case 'Certificate Amendment':
this.parentType = 'Authorizations';
Expand All @@ -58,7 +59,17 @@ export class Collection {

// Check status next
if (this.parentType === 'Authorizations' && !this.status) {
this.status = (this.type === 'Permit' || this.type === 'Certificate') ? 'Issued' : 'Amended';
switch (this.type) {
case 'Permit':
case 'Certificate':
this.status = 'Issued';
break;
case 'Amalgamated Permit':
this.status = 'Amalgamated';
break;
default:
this.status = 'Amended';
}
}

// Set documents
Expand Down
14 changes: 11 additions & 3 deletions src/app/pipes/remove-string-value.pipe.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { RemoveStringValuePipe } from 'app/pipes/remove-string-value.pipe';

describe('RemoveStringValuePipe', () => {

const toReplace = ' Amendment';
let value: string;
let expectedResponse: string;

Expand All @@ -13,7 +12,16 @@ describe('RemoveStringValuePipe', () => {
value = 'Permit Amendment Amended';
expectedResponse = 'Permit Amended';

expect(pipe.transform(value, toReplace)).toBe(expectedResponse);
expect(pipe.transform(value, ' Amendment')).toBe(expectedResponse);
});
});

describe('given input with duplicate string value match first instance', () => {
it('returns expected output', () => {
value = 'Amalgamated Permit Amalgamated';
expectedResponse = 'Permit Amalgamated';

expect(pipe.transform(value, 'Amalgamated')).toBe(expectedResponse);
});
});

Expand All @@ -22,7 +30,7 @@ describe('RemoveStringValuePipe', () => {
value = 'Permit Amended';
expectedResponse = 'Permit Amended';

expect(pipe.transform(value, toReplace)).toBe(expectedResponse);
expect(pipe.transform(value, ' Amendment')).toBe(expectedResponse);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ <h3>{{agency.act}} <span>{{agency.name}}</span></h3>
</a>
<span class="accordion__collapse-header--column authorizations-list__name-col">{{formatDisplayName(c)}}</span>
<span class="accordion__collapse-header--column authorizations-list__date-col">
<span>{{c.type | removeStringValue: "Amendment"}} {{c.status}}</span> -
<span>{{c.type | removeStringValue: "Amendment" | removeStringValue: "Amalgamated"}} {{c.status}}</span> -
<span>{{c.date | date:'yyyy-MM-dd'}}</span>
</span>
</div>
Expand Down

0 comments on commit 184c0ad

Please sign in to comment.