Skip to content

Commit

Permalink
fix(geography): in-memory collection does not exist (#2610)
Browse files Browse the repository at this point in the history
  • Loading branch information
griest024 committed Nov 21, 2023
1 parent cc28a38 commit d9bbcb6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ describe('DaffInMemoryBackendGeographyService | Unit', () => {
findById: (ary, id) => ary.find(e => e.id === id),
},
};
reqInfoStub.req.body.countries = collection;
service.createDb(reqInfoStub);
});

it('should be created', () => {
Expand Down Expand Up @@ -76,17 +78,4 @@ describe('DaffInMemoryBackendGeographyService | Unit', () => {
expect(result.body).toEqual([mockCountry]);
});
});

describe('createDb', () => {
let result;

beforeEach(() => {
result = service.createDb(reqInfoStub);
});

it('should return a object with an array of countries', () => {
expect(Array.isArray(result.countries)).toEqual(true);
expect(result.countries.length).toBeGreaterThan(2);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ export class DaffInMemoryBackendGeographyService implements InMemoryDbService, D
}

private getCountry(reqInfo: RequestInfo) {
return reqInfo.collection.find(country => country.id === reqInfo.id);
return this.countries.find(country => country.id === reqInfo.id);
}

private listCountries(reqInfo: RequestInfo) {
return reqInfo.collection;
return this.countries;
}
}

0 comments on commit d9bbcb6

Please sign in to comment.