Closed gabor closed 3 months ago
@gabor why do you have to mock FrameFromRows?
@scottlepp what i want to test is the functionality that we do AFTER FrameFromRows
is called.
problem is, if i want to call getFrames
from the unit-test, i have to provide it a working sql.Rows
object... which i don't know how .... is there maybe some helper function in sqlds-repo that helps creating sql.Rows
objects?
@gabor try https://github.com/grafana/sqlds/blob/main/mock/sqlmock.go#L51
You can create a mock driver and return whatever you want.
Here is a test that uses the mock driver.
@scottlepp thanks for the info 👍 , i updated teh PR to use the mentioned test framework.
sorry @scottlepp , could you re-review it pls? i added one more commit, to cover all possible format
s.
(part of https://github.com/grafana/sqlds/issues/118)
i wanted to add unit-tests that describe the current situation, i'll create a separate PR next that does the change.
NOTE: i had to do a small refactor of the code, because i don't know how to mock
sqlutil.FrameFromRows
. if anyone has a better idea, i'm all ears.