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

Cost Surface - shapefile converting & extracting PU cost/id #219

Merged
merged 4 commits into from
Jun 1, 2021

Conversation

kgajowy
Copy link
Contributor

@kgajowy kgajowy commented May 28, 2021

Includes moving isDefined into lib (util)

(yes, I messed up branch name with switching surface/cost order 😅 )

@vercel
Copy link

vercel bot commented May 28, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployments, click below or on the icon next to each commit.

marxan – ./app

🔍 Inspect: https://vercel.com/vizzuality1/marxan/5mD6uVukov3SiWe8Mzcp1cbFJBe2
✅ Preview: https://marxan-git-geoprocessing-surface-cost-vizzuality1.vercel.app

marxan-storybook – ./app

🔍 Inspect: https://vercel.com/vizzuality1/marxan-storybook/FLzzbdY4BjmXcGqVKTsBgAPzA7ko
✅ Preview: https://marxan-storybook-git-geoprocessing-surface-cost-vizzuality1.vercel.app

@kgajowy
Copy link
Contributor Author

kgajowy commented May 28, 2021

  • TODO: e2e specs don't see libs, config needs to be updated

});

describe(`when given GeoJson has pu costs`, () => {
it(`throws exception`, () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the test description doesn't sound right

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in 573622f

describe(`when given GeoJson isn't a FeatureCollection`, () => {
it(`throws exception`, () => {
expect(() => sut.extract(fixtures.simpleGeometry())).toThrow(
/is supported/,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super minor - we'll see the test passing, but asserting that an exception will be raised containing the text is supported seems slightly misleading (why should an error be thrown if something "is supported"?): in this specific case, maybe matching case-insensitively the full text of the error (/Only FeatureCollection is supported/i) should make things clearer for whoever skims through these tests in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in 573622f

cost: number;
planningUnitId: string;
};
type MaybeProperties = Partial<Properties> | undefined | null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is quite useful in general - I suggest to create a MaybeSome<T> and then type MaybeProperties = MaybeSome<Properties> or something like that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

};
type MaybeProperties = Partial<Properties> | undefined | null;

export class ExtractPuCost implements PuExtractorPort {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not too keen on class names based on verbs - why don't we name this PuCostExtractor?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would also match some of your previous code

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants