Skip to content

Commit

Permalink
test(token-price): init coverage for new price method PE-7171
Browse files Browse the repository at this point in the history
  • Loading branch information
fedellen committed Nov 22, 2024
1 parent 27356df commit 516bb72
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion tests/turbo.node.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ import {
} from '../src/common/turbo.js';
import { TurboFactory } from '../src/node/factory.js';
import { TurboNodeSigner } from '../src/node/signer.js';
import { NativeAddress, TokenType, TurboSigner } from '../src/types.js';
import {
NativeAddress,
TokenType,
TurboSigner,
tokenTypes,
} from '../src/types.js';
import { signerFromKyveMnemonic } from '../src/utils/common.js';
import { FailedRequestError } from '../src/utils/errors.js';
import {
Expand Down Expand Up @@ -337,6 +342,23 @@ describe('Node environment', () => {
expect(fees).to.have.length(1);
});

describe.only('getTokenPriceForBytes()', async () => {
const bytes = 1024 * 1024 * 100; // 100 MiB
for (const token of tokenTypes) {
it(`should return the correct token price for the given bytes for ${token}`, async () => {
const { tokenPrice, bytes: bytesResult } =
await TurboFactory.unauthenticated({
token,
}).getTokenPriceForBytes({
bytes,
});
expect(tokenPrice).to.not.be.undefined;
expect(bytesResult).to.equal(bytes);
expect(+tokenPrice).to.be.a('number');
});
}
});

describe('uploadSignedDataItem()', () => {
const signer = new ArweaveSigner(testJwk);
it('should properly upload a signed Buffer to turbo', async () => {
Expand Down

0 comments on commit 516bb72

Please sign in to comment.