Skip to content

Commit

Permalink
fix: Fix flaky test (#2314)
Browse files Browse the repository at this point in the history
## Why is this change needed?

Fix flaky timestamp test that was relying `expiry` instead of
`blockTimestamp` for storage rent.

## Merge Checklist

_Choose all relevant options below by adding an `x` now or at any time
before submitting for review_

- [x] PR title adheres to the [conventional
commits](https://www.conventionalcommits.org/en/v1.0.0/) standard
- [ ] PR has a
[changeset](https://github.com/farcasterxyz/hub-monorepo/blob/main/CONTRIBUTING.md#35-adding-changesets)
- [x] PR has been tagged with a change label(s) (i.e. documentation,
feature, bugfix, or chore)
- [ ] PR includes
[documentation](https://github.com/farcasterxyz/hub-monorepo/blob/main/CONTRIBUTING.md#32-writing-docs)
if necessary.


<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to update the storage cache test by adjusting
the values of `units` and `legacy_units`.

### Detailed summary
- Updated `units` and `legacy_units` values in the storage cache test
- Added `blockTimestamp` to `storageRentEvent`

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your
question}`

<!-- end pr-codex -->
  • Loading branch information
sanjayprabhu authored Sep 16, 2024
1 parent f084daa commit 0a655b9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions apps/hubble/src/storage/stores/storageCache.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ describe("syncFromDb", () => {
for (let i = 0; i < fidUsage.usage.storage; i++) {
const storageRentEvent = Factories.StorageRentOnChainEvent.build({
fid: fidUsage.fid,
blockTimestamp: Date.now() / 1000,
storageRentEventBody: Factories.StorageRentEventBody.build({
expiry: getFarcasterTime()._unsafeUnwrap() + 365 * 24 * 60 * 60 - i,
units: 2,
}),
});
Expand All @@ -81,8 +81,8 @@ describe("syncFromDb", () => {
ok(fidUsage.usage.userData),
);
const slot = (await cache.getCurrentStorageSlotForFid(fidUsage.fid))._unsafeUnwrap();
expect(slot.legacy_units).toEqual(4);
expect(slot.units).toEqual(0);
expect(slot.units).toEqual(4);
expect(slot.legacy_units).toEqual(0);
}
});
});
Expand Down

0 comments on commit 0a655b9

Please sign in to comment.