Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions CODING.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,17 @@ can even run your own!
a specific bee client, written in the `go` programming language, while
`bee`, in lower case, refers to any worker that can join a swarm
(e.g. any client implementation that speaks the Swarm protocol).

## Component Testing

### Calculator Component

If you modify `src/components/AmountAndDepthCalc.js` (the postage stamp cost calculator), you **must** run the automated tests before submitting your PR:

```bash
node src/components/AmountAndDepthCalc.test.js
```

All 37 tests must pass (`PASSED: 37`). If any test fails, your changes have introduced a bug. Fix the issue and re-run the tests.

For detailed information about what the tests cover and how to debug failures, see `.claude/README-CALCULATOR-TESTING.md`.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,28 @@ npm run build

This command generates static content into the `build` directory and can be served using any static contents hosting service.

### Testing

#### Calculator Component Tests

If you modify the postage stamp cost calculator component (`src/components/AmountAndDepthCalc.js`), you should run the automated tests to verify your changes:

```bash
node src/components/AmountAndDepthCalc.test.js
```

This runs 37 unit tests covering:
- Time conversion (hours, days, weeks, years)
- Depth selection and cost calculation
- Data table integrity and consistency
- Edge cases and boundary conditions

**Expected output:** `PASSED: 37` (all tests should pass)

If any tests fail, it indicates a bug in the calculator logic. Please investigate and fix before submitting your PR.

For more information about the calculator tests, see: `.claude/README-CALCULATOR-TESTING.md`


### Note about lunr search plugin

Expand Down
50 changes: 25 additions & 25 deletions src/components/AmountAndDepthCalc.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,31 @@ function FetchPriceComponent() {
const depthToEffectiveVolume = {
unencrypted: {
none: {
17: { label: "44.70 kB", gb: 0.000043 },
18: { label: "6.66 MB", gb: 0.006504 },
19: { label: "112.06 MB", gb: 0.109434 },
20: { label: "687.62 MB", gb: 0.671504 },
21: { label: "2.60 GB", gb: 2.60 },
22: { label: "7.73 GB", gb: 7.73 },
23: { label: "19.94 GB", gb: 19.94 },
24: { label: "47.06 GB", gb: 47.06 },
25: { label: "105.51 GB", gb: 105.51 },
26: { label: "227.98 GB", gb: 227.98 },
27: { label: "476.68 GB", gb: 476.68 },
28: { label: "993.65 GB", gb: 993.65 },
29: { label: "2.04 TB", gb: 2088.96 },
30: { label: "4.17 TB", gb: 4270.08 },
31: { label: "8.45 TB", gb: 8652.80 },
32: { label: "17.07 TB", gb: 17479.68 },
33: { label: "34.36 TB", gb: 35184.64 },
34: { label: "69.04 TB", gb: 70696.96 },
35: { label: "138.54 TB", gb: 141864.96 },
36: { label: "277.72 TB", gb: 284385.28 },
37: { label: "556.35 TB", gb: 569702.40 },
38: { label: "1.11 PB", gb: 1163919.36 },
39: { label: "2.23 PB", gb: 2338324.48 },
40: { label: "4.46 PB", gb: 4676648.96 },
41: { label: "8.93 PB", gb: 9363783.68 },
17: { label: "39.932 KB", gb: 0.000039 },
18: { label: "5.808 MB", gb: 0.005664 },
19: { label: "97.742 MB", gb: 0.095432 },
20: { label: "599.775 MB", gb: 0.585527 },
21: { label: "2.217 GB", gb: 2.217 },
22: { label: "6.584 GB", gb: 6.584 },
23: { label: "16.987 GB", gb: 16.987 },
24: { label: "33.974 GB", gb: 33.974 },
25: { label: "67.948 GB", gb: 67.948 },
26: { label: "135.896 GB", gb: 135.896 },
27: { label: "271.792 GB", gb: 271.792 },
28: { label: "543.584 GB", gb: 543.584 },
29: { label: "1.087 TB", gb: 1087.168 },
30: { label: "2.174 TB", gb: 2174.336 },
31: { label: "4.349 TB", gb: 4348.672 },
32: { label: "8.698 TB", gb: 8697.344 },
33: { label: "17.395 TB", gb: 17394.688 },
34: { label: "34.791 TB", gb: 34789.376 },
35: { label: "69.582 TB", gb: 69578.752 },
36: { label: "139.163 TB", gb: 139157.504 },
37: { label: "278.327 TB", gb: 278315.008 },
38: { label: "556.654 TB", gb: 556630.016 },
39: { label: "1.113 PB", gb: 1113260.032 },
40: { label: "2.227 PB", gb: 2226520.064 },
41: { label: "4.453 PB", gb: 4453040.128 },
},
medium: {
17: { label: "41.56 kB", gb: 0.000040 },
Expand Down
Loading
Loading