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

fix: if there are no postage stamps the getAllPostageBatch should return [] #319

Merged
merged 2 commits into from
May 20, 2021

Conversation

vojtechsimetka
Copy link
Contributor

No idea how to test this since the tests are in random order and I can not guarantee there is no postage stamp, right?

@vojtechsimetka vojtechsimetka changed the title fix: if there are no postage stamps the getAllPostageBatch returns null fix: if there are no postage stamps the getAllPostageBatch should return [] May 20, 2021
@AuHau
Copy link
Contributor

AuHau commented May 20, 2021

Thanks! Good catch! I fixed this for the pinning endpoint but forgot that this will be the case here as well.

I think that actually, the approach here is to check if null is returned and then return empty array instead.

https://github.com/ethersphere/bee-js/blob/bee-0.6.0/src/modules/pinning.ts#L73

@AuHau
Copy link
Contributor

AuHau commented May 20, 2021

Haha, yeah, you were faster.

Copy link
Contributor

@AuHau AuHau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vojtechsimetka
Copy link
Contributor Author

This should actually be even simpler because null || [] results in []

@AuHau AuHau merged commit 39d8821 into bee-0.6.0 May 20, 2021
@AuHau AuHau deleted the fix/postage-stamps-can-be-null branch May 20, 2021 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants