-
Notifications
You must be signed in to change notification settings - Fork 5
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
Conversation
This pull request is being automatically deployed with Vercel (learn more). marxan – ./app🔍 Inspect: https://vercel.com/vizzuality1/marxan/5mD6uVukov3SiWe8Mzcp1cbFJBe2 marxan-storybook – ./app🔍 Inspect: https://vercel.com/vizzuality1/marxan-storybook/FLzzbdY4BjmXcGqVKTsBgAPzA7ko |
28e1865
to
a2f77e1
Compare
|
a2f77e1
to
9975f73
Compare
9975f73
to
3904d4f
Compare
}); | ||
|
||
describe(`when given GeoJson has pu costs`, () => { | ||
it(`throws exception`, () => { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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/, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Includes moving
isDefined
into lib (util
)(yes, I messed up branch name with switching surface/cost order 😅 )