When I updated refactored the Selection system, I forgot about the test suite for selections
which, naturally, totally broke. It was a good thing too, because fixing these tests gave
me the opportunity to fix a number of other things:
Since the new Selection class requires that TheProject be intitialized, we needed to
bring Project into the test script. Through this, I discovered that Project wasn't
able to run outside the browser (due to relying on a global THREE (three.js) and
still using XMLHTTPRequest). I've updated the Project class, so that it will import
THREE itself and will use the Client class to fetch the project.json data.
Also, since initializing a Project requires an async fetch, the class's API has been
updated to be properly async. This means the Project constructor is now private!
Instead, you should use the static Project.getProject() which will return a Promise
that will resolve into the actual Project instance. compare.js has been updated
to use this new interface.
On top of all that, fixing the test script uncovered some errors in the Selection
class (hey, it's what the tests are there for!). Namely, the logic around how it
converts one kind of unit to another has been updated to match that of the old
implementation.
When I updated refactored the Selection system, I forgot about the test suite for selections which, naturally, totally broke. It was a good thing too, because fixing these tests gave me the opportunity to fix a number of other things:
Since the new Selection class requires that
TheProject
be intitialized, we needed to bringProject
into the test script. Through this, I discovered thatProject
wasn't able to run outside the browser (due to relying on a globalTHREE
(three.js) and still usingXMLHTTPRequest
). I've updated the Project class, so that it will import THREE itself and will use the Client class to fetch the project.json data.Also, since initializing a Project requires an async fetch, the class's API has been updated to be properly async. This means the
Project
constructor is now private! Instead, you should use the staticProject.getProject()
which will return a Promise that will resolve into the actual Project instance.compare.js
has been updated to use this new interface.On top of all that, fixing the test script uncovered some errors in the Selection class (hey, it's what the tests are there for!). Namely, the logic around how it converts one kind of unit to another has been updated to match that of the old implementation.