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

TD-2263 Adding infofile validator #17

Merged
merged 16 commits into from
Mar 27, 2024

Conversation

arpadlomenipg
Copy link
Contributor

@arpadlomenipg arpadlomenipg commented Mar 22, 2024

Contributes to TD-2263

Changes

A supporting function for TD-2263, but could be used in other applications too later.

It adds an infofile validator to the infofile-utils. Additionally, I infofiles into the repository for the unit tests. The current options to for infofile validations are :

  • "Vehicle" (looks either for Car, Motorcycle or Truck infofile)
  • "TestRun" (looks for TestRun infofile)
  • "Road" (looks for Road infofile)
  • "Model" (looks for anything else, which is a valid infofile, be that a Trailer, a sensor model, etc.

The basis of the validation is always the "FileIdent" property of the infofile, an appropriate RegEx search is carried out for each of the options listed above.

Dependencies

UI/UX

Testing notes

Author checklist before assigning a reviewer

  • Reviewed my own code-diff.
  • Branch has been run in docker.
  • PR assigned to me or an appropriate delegate.
  • Relevant labels added to the PR.
  • Appropriate tests have been added.
  • Lint and test workflows pass.

@arpadlomenipg arpadlomenipg self-assigned this Mar 22, 2024
@arpadlomenipg arpadlomenipg added the enhancement New feature or request label Mar 22, 2024
@mattcorner mattcorner self-requested a review March 22, 2024 14:47
Copy link
Contributor

@mattcorner mattcorner left a comment

Choose a reason for hiding this comment

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

Nice work, left some suggestions.

src/isValidInfoFile.js Outdated Show resolved Hide resolved
src/isValidInfoFile.js Outdated Show resolved Hide resolved
src/isValidInfoFile.js Outdated Show resolved Hide resolved
src/isValidInfoFile.js Show resolved Hide resolved
src/index.js Show resolved Hide resolved
src/__tests__/isValidInfoFile.test.js Outdated Show resolved Hide resolved
src/isValidInfoFile.js Outdated Show resolved Hide resolved
src/__tests__/isValidInfoFile.test.js Outdated Show resolved Hide resolved
@mattcorner mattcorner changed the title Enhancement/adding infofile validator TD-2263 Adding infofile validator Mar 26, 2024
Copy link
Contributor

@mattcorner mattcorner left a comment

Choose a reason for hiding this comment

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

Minor typo in the README.

README.md Outdated Show resolved Hide resolved
@mattcorner
Copy link
Contributor

I've published a pre-release for you so that you can start making use if it in VIRTO as a final test: @ipguk/infofile-utils@1.1.0-0

Copy link
Contributor

@mattcorner mattcorner left a comment

Choose a reason for hiding this comment

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

failing CI

@arpadlomenipg
Copy link
Contributor Author

Sorry, turns out file names are case insensitive on windows, but not on linux, hence the unexpected unit test fail here

I added a bunch of new types, removed the type "Model", changed the RegEx search pattern when calling without type

@arpadlomenipg
Copy link
Contributor Author

arpadlomenipg commented Mar 27, 2024

I am done with the testing of the pre-release 1.1.0-1 in Virto, I have not encountered any problems. I looked through the code, this implementation has all the necessary types to use it in Virto-apps, where currently an infofile validation is being used with a local implementation, so I have no plans to expand it with more types now.

Copy link
Contributor

@mattcorner mattcorner left a comment

Choose a reason for hiding this comment

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

lgtm. merge the PR and drop me a message to do the release

@arpadlomenipg arpadlomenipg merged commit caec7d1 into main Mar 27, 2024
2 checks passed
@arpadlomenipg arpadlomenipg deleted the enhancement/adding-infofile-validator branch March 27, 2024 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants