Skip to content

Refactor: extract function for canonicalising modeled methods#3518

Merged
shati-patel merged 1 commit intomainfrom
shati-patel/compare-modeled-methods
Mar 27, 2024
Merged

Refactor: extract function for canonicalising modeled methods#3518
shati-patel merged 1 commit intomainfrom
shati-patel/compare-modeled-methods

Conversation

@shati-patel
Copy link
Copy Markdown
Contributor

@shati-patel shati-patel commented Mar 27, 2024

[🍐 paired with Charis]

We don't currently (I think) have an easy way to check whether two modeled methods are the same. I've shuffled some stuff around, so that you can now compare modeled methods by checking that their "key" is the same, i.e. createModeledMethodKey(method1) === createModeledMethodKey(method2).

(Not used yet, but I plan to use this for jumping between corresponding models in the model editor and the model alerts view)

Checklist

N/A: no user-facing changes

  • CHANGELOG.md has been updated to incorporate all user visible changes made by this pull request.
  • Issues have been created for any UI or other user-facing changes made by this pull request.
  • [Maintainers only] If this pull request makes user-facing changes that require documentation changes, open a corresponding docs pull request in the github/codeql repo and add the ready-for-doc-review label there.

We don't currently (I think) have an easy way to check whether two modeled methods are the same. I've shuffled some stuff around, so that you can now compare modeled methods by check that their "key" (i.e. JSON-stringified form) is the same.
@shati-patel shati-patel requested a review from a team as a code owner March 27, 2024 11:07
Copy link
Copy Markdown
Contributor

@charisk charisk left a comment

Choose a reason for hiding this comment

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

LGTM, but since we paired, I'd be keen to get reviews from others too.

Copy link
Copy Markdown
Member

@koesie10 koesie10 left a comment

Choose a reason for hiding this comment

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

LGTM, but it would be nice to add some tests. This method was implicitly tested by validation.test.ts before, but now that it has been moved around and is in a different file, it might be good to add some tests for this method specifically.

@shati-patel
Copy link
Copy Markdown
Contributor Author

Good idea about unit tests! I'll do that in a follow-up PR 👀

@shati-patel shati-patel merged commit fcf74b3 into main Mar 27, 2024
@shati-patel shati-patel deleted the shati-patel/compare-modeled-methods branch March 27, 2024 14:40
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