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

Use ES6 module style to enable frontend unit tests #746

Closed
mtlynch opened this issue Jul 16, 2021 · 1 comment
Closed

Use ES6 module style to enable frontend unit tests #746

mtlynch opened this issue Jul 16, 2021 · 1 comment
Assignees
Labels
Milestone

Comments

@mtlynch
Copy link
Contributor

mtlynch commented Jul 16, 2021

Splitting off from #538 (comment)

It would be nice if we could write unit tests for TinyPilot's frontend, which currently has no automated tests. To do this, we need to use ES6 module syntax so that we can run unit tests under Node and import our web components.

@jotaen
Copy link
Contributor

jotaen commented Aug 17, 2021

Fixed via https://github.com/tiny-pilot/tinypilot-pro/pull/231.

We now have everything in place so that we can start writing unit tests in the frontend. I think good candidates to start with would be prettifyByteSize or futureLocation. (We would need to extract these beforehand, of course.)

@jdeanwallace fyi, we are using ES6 modules now everywhere in the frontend. The differences in a nutshell: the <script> blocks are all type “module” now. That means, that all dependencies must be imported, like the controller functions or the dialog events. We don’t have the global scripts anymore, since these files have been migrated to be modules. There is also no js/util folder anymore, but only one folder with all our importable JavaScript modules.

@jotaen jotaen closed this as completed Aug 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants