Skip to content

Conversation

@brendankenny
Copy link
Contributor

something missed in #8727

@brendankenny brendankenny requested a review from patrickhulce as a code owner May 9, 2019 20:55
Copy link
Collaborator

@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

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

change itself LGTM!

if (isArrayOfUnknownObjects(timings)) {
budget.timings = timings.map(Budget.validateTimingBudget);
Budget.assertNoDuplicateStrings(budget.timings.map(r => r.metric),
`budget[${index}].timings`);
Copy link
Collaborator

Choose a reason for hiding this comment

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

should these read budgets[${index}] since that's the property name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

should these read budgets[${index}] since that's the property name?

yeah, good call

it('throws when a duplicate resourceType is specified in resourceCounts', () => {
budget[0].resourceCounts.push({resourceType: 'third-party', budget: 100});
assert.throws(_ => Budget.initializeBudget(budget),
/budget\[0\]\.resourceCounts has duplicate entry of type 'third-party'/);
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe consider expect().toThrow('the message') to avoid regex escape noise when we're doing exact string matching?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

maybe consider expect().toThrow('the message') to avoid regex escape noise when we're doing exact string matching?

yeah, this whole file should probably switch over...

* @param {Array<string>} arr
* @param {string} arrayName
*/
static assertNoDuplicateStrings(arr, arrayName) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

arr feels a bit of an unnecessary abbreviation 😛

Copy link
Contributor Author

Choose a reason for hiding this comment

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

arr feels a bit of an unnecessary abbreviation 😛

very fair :)

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.

2 participants