Error render phase
In my PR:https://github.com/tscircuit/core/pull/253 my tests are failing saying I cannot destructure
db
from this.root
but w/o doing so how will I insert errors š¤14 Replies
You can only access the db in a render phase, in this case you should insert it during doInitialPcbVomponentRender
Youll need to indicate that the component has an error and store it on the component until that phase to insert the error
You could introduce this._missingFootprintError
Then insert that into the db during the doInitialPcbComponentRender
Thanks for help š«”
no problem!!!
Tests are now passing : )
happy to review, just send me a link!
sure here it is https://github.com/tscircuit/core/pull/253
Thanks for the review, resolving them asap.
np!
Hi, While creating a flaky test case I need to use
component.doInitialPcbComponentRender();
but while running the test I'm constantly getting these errors
here is my test case I've kept it very simple just to do testing:
can you use the normal testing pattern (the one in CREATING_TESTS.md) the issue with that unit test is the component isn't set up to render but you're calling a render method
*WRITING_TESTS.md
Gotcha!! Will try this way
An ordinary
<chip
or <resistor />
is a type of NormalComponent, i would recommend just creating a simple resistor <resistor resistance="1k" footprint="0402" />
and logging to make sure the function is calledAdded the tests : )
Now its working good
nice work!!!
Thank you so much, your review is needed in this one too https://github.com/tscircuit/easyeda-converter/pull/109