surrealdb.go icon indicating copy to clipboard operation
surrealdb.go copied to clipboard

Bug: Broken Tests for Fetch

Open sbshah97 opened this issue 1 year ago • 5 comments

Describe the bug

This bug is a follow up from the below PR. This requires us to fix testcases listed in TestFetch() This is not a bug in the SDK and a bug in the core engine which needs to be fixed.

https://github.com/surrealdb/surrealdb.go/pull/115

Steps to reproduce

  1. Comment out s.T().Skip
  2. Run testcase and ensure it passes successfully

Expected behaviour

The tests listed above are expected to pass.

SurrealDB version

surreal 1.0.0 for MacOS

Contact Details

[email protected]

Is there an existing issue for this?

  • [X] I have searched the existing issues

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

sbshah97 avatar Dec 01 '23 00:12 sbshah97

Thinking briefly here, this may be to do with deserialising the results from fetch. We might want to try to reproduce a JSON reponse to the deserialiser for a test.

phughk avatar Dec 01 '23 14:12 phughk

Also, this might be related in case it is deserialisation: https://stackoverflow.com/questions/77553464/deserializing-a-graph-query/77582309#77582309

phughk avatar Dec 01 '23 14:12 phughk

We might want to try to reproduce a JSON reponse to the deserialiser for a test. This would be a test in the core engine surrealdb code itself?

sbshah97 avatar Dec 01 '23 15:12 sbshah97

This would be a test in the driver. We would have a fake network layer, and fake json responses.

fakeNetwork := FakeNetwork() // This doesnt exist, we would need to create a mock or something
driver := fakeNetwork.newDriver() // Hypothetically. We basically need a factory that allows a network layer to be injected for testing

fakeNetwork.when(any()).then(someJson)

let result = driver.query(bla)

assertResult(result)

Something like that

phughk avatar Dec 04 '23 09:12 phughk

I guess this is a known issue, but would like to make it more obvious. I believe that https://github.com/surrealdb/surrealdb/issues/3028 block this issue as any parsing after fetch will result in an error.

varshard avatar Feb 12 '24 10:02 varshard