Skip to content

Commit

Permalink
Merge pull request #130 from etchteam/feature/wrap-635-residual-colle…
Browse files Browse the repository at this point in the history
…ctions-still-show-on-the-home-recycling-list

Handle the api removal of residual schemes
  • Loading branch information
DanWebb authored May 8, 2024
2 parents db65549 + 488f409 commit 110bc26
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 73 deletions.
2 changes: 0 additions & 2 deletions src/lib/getContainerList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { Container, LocalAuthorityProperty } from '@/types/locatorApi';

export interface ContainerList {
Dry?: LocalAuthorityProperty[];
Residual?: Container[];
Garden?: Container[];
Food?: Container[];
}
Expand Down Expand Up @@ -71,7 +70,6 @@ export default function getContainerList(

// Group the schemes by type
const streamType = groupBy(property, 'type');
delete streamType.Residual;

containerList.Dry = streamType.Dry ?? [];

Expand Down
2 changes: 1 addition & 1 deletion src/types/locatorApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export enum PROPERTY_TYPE_CY {

export interface LocalAuthorityProperty {
name: string;
type: 'Dry' | 'Food' | 'Garden' | 'Residual';
type: 'Dry' | 'Food' | 'Garden';
containers: Container[];
notes?: string[];
}
Expand Down
56 changes: 0 additions & 56 deletions tests/mocks/localAuthority.ts
Original file line number Diff line number Diff line change
Expand Up @@ -586,34 +586,6 @@ export const LocalAuthorityResponse: LocalAuthority = {
notes:
'Fortnightly Collections through out the year. Collections suspended Christmas week and New Years week.',
},
{
name: 'All properties',
type: 'Residual',
containers: [
{
name: 'Wheeled Bin',
displayName: 'Wheeled Bin (240L)',
bodyColour: '#4f4f4f',
lidColour: '#4f4f4f',
notes: [],
},
{
name: 'Non-Reusable Sack',
displayName: 'Non-Reusable Sack',
bodyColour: '#4f4f4f',
lidColour: '#4f4f4f',
notes: [],
},
{
name: 'Communal Wheeled Bin',
displayName: 'Communal Wheeled Bin (181 to 240L)',
bodyColour: '#4f4f4f',
lidColour: null,
notes: [],
},
],
notes: '870 are on 140 litre wheeled bins',
},
],
'Kerbside properties': [
{
Expand Down Expand Up @@ -1458,34 +1430,6 @@ export const LocalAuthorityResponse: LocalAuthority = {
notes:
'Fortnightly Collections through out the year. Collections suspended Christmas week and New Years week.',
},
{
name: 'All properties',
type: 'Residual',
containers: [
{
name: 'Wheeled Bin',
displayName: 'Wheeled Bin (240L)',
bodyColour: '#4f4f4f',
lidColour: '#4f4f4f',
notes: [],
},
{
name: 'Non-Reusable Sack',
displayName: 'Non-Reusable Sack',
bodyColour: '#4f4f4f',
lidColour: '#4f4f4f',
notes: [],
},
{
name: 'Communal Wheeled Bin',
displayName: 'Communal Wheeled Bin (181 to 240L)',
bodyColour: '#4f4f4f',
lidColour: null,
notes: [],
},
],
notes: '870 are on 140 litre wheeled bins',
},
],
},
};
16 changes: 2 additions & 14 deletions tests/unit/getContainerList.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,6 @@ const mock: LocalAuthorityProperty[] = [
},
],
},
{
name: 'Kerbside Properties - Wycombe area',
type: 'Residual',
containers: [
{
name: 'Wheeled Bin',
displayName: 'Wheeled Bin',
bodyColour: 'Black',
lidColour: 'Black',
},
],
},
{
name: 'Communal Properties - Chiltern area',
type: 'Dry',
Expand Down Expand Up @@ -110,7 +98,7 @@ const mock: LocalAuthorityProperty[] = [
describe('getContainerList', () => {
test('Returns a list of containers in the expected format', () => {
expect(getContainerList(mock)).toEqual({
Dry: [mock[0], mock[2]],
Dry: [mock[0], mock[1]],
Garden: [mock[3].containers[0]],
});
});
Expand All @@ -128,7 +116,7 @@ describe('searchContainerList', () => {
test('Search returns containerList of containers with matching materials', () => {
expect(searchContainerList(mockContainerList, 'Aluminium foil')).toEqual({
containerList: {
Dry: [{ ...mock[0], containers: [mock[0].containers[0]] }, mock[2]],
Dry: [{ ...mock[0], containers: [mock[0].containers[0]] }, mock[1]],
},
containerCount: 2,
searchResult: 'positive',
Expand Down

0 comments on commit 110bc26

Please sign in to comment.