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

Shape testing of the bee endpoint responses #606

Open
vojtechsimetka opened this issue Mar 31, 2022 · 1 comment
Open

Shape testing of the bee endpoint responses #606

vojtechsimetka opened this issue Mar 31, 2022 · 1 comment
Labels
kind:enhancement A net-new feature or an improvement to an existing feature type:issue

Comments

@vojtechsimetka
Copy link
Contributor

vojtechsimetka commented Mar 31, 2022

This has been discussed on our roundtable on March 31st. We will start implementing it gradually to different endpoints. The idea is to type the expected shape array with the return type of a given function.

Here is a dump of the proposal:

rationale:

  • it has happened to us several times already that the responses from bee version we officially supported did not match the bee-js type
  • as far as I recall, in 2 cases it was missing properties, in one case it was wrong type of properties and in one it was removed property

proposal:

interface TestInterface {
  foo: string
  bar?: number
}

const validShapes: TestInterface[] = [{foo: 'hi'}, {foo: 'yo!', bar: 1}]

expect(res).toMatchOneOf(validShapes)
@vojtechsimetka vojtechsimetka added the kind:enhancement A net-new feature or an improvement to an existing feature label Mar 31, 2022
@AuHau
Copy link
Contributor

AuHau commented Apr 4, 2022

I think this was already once or twice brought up before but we have never really decided to do this.

From my POW I am done doing it, especially as we are promising some returned types/interfaces from the API calls that we are not really sure if it is correct or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:enhancement A net-new feature or an improvement to an existing feature type:issue
Projects
None yet
Development

No branches or pull requests

2 participants