Skip to content

Commit 855b309

Browse files
test(contract): update community fee tests and enable retry tests
- Change community fee from 50% to 15% in tests - Move contract reader stub to beforeEach block for better test isolation - Enable previously skipped tests for file transaction retries with incomplete chunks
1 parent 44f6f45 commit 855b309

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

src/community/ardrive_community_oracle.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe('The ArDriveCommunityOracle', () => {
1515
const communityOracle = new ArDriveCommunityOracle(fakeArweave, [stubContractReader]);
1616

1717
// 50% stubbed fee of 100 million Winston is 50 million winston
18-
expect(+(await communityOracle.getCommunityWinstonTip(W(100_000_000)))).to.equal(50_000_000);
18+
expect(+(await communityOracle.getCommunityWinstonTip(W(100_000_000)))).to.equal(15_000_000);
1919
});
2020

2121
it('returns the expected minimum community tip result when the derived tip is below the minimum', async () => {

src/community/ardrive_contract_oracle.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ describe('The ArDriveContractOracle', () => {
2929

3030
describe('getPercentageFromContract method', () => {
3131
it('returns the expected fee result', async () => {
32-
expect(await arDriveContractOracle.getTipPercentageFromContract()).to.equal(0.5);
32+
expect(await arDriveContractOracle.getTipPercentageFromContract()).to.equal(0.15);
3333
});
3434

3535
it('throws an error if fee does not exist', async () => {

tests/integration/arlocal.int.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,6 @@ describe('ArLocal Integration Tests', function () {
8585

8686
const arweaveOracle = new GatewayOracle(gatewayUrlForArweave(arweave));
8787
const fakeContractReader = new PDSContractCacheServiceContractReader();
88-
stub(fakeContractReader, 'readContract').resolves(stubCommunityContract);
89-
9088
const communityOracle = new ArDriveCommunityOracle(arweave, [fakeContractReader]);
9189
const priceEstimator = new ARDataPriceNetworkEstimator(arweaveOracle);
9290
const walletDao = new WalletDAO(arweave, 'ArLocal Integration Test', fakeVersion);
@@ -167,6 +165,7 @@ describe('ArLocal Integration Tests', function () {
167165

168166
beforeEach(() => {
169167
stub(communityOracle, 'selectTokenHolder').resolves(stubArweaveAddress());
168+
stub(fakeContractReader, 'readContract').resolves(stubCommunityContract);
170169
});
171170

172171
describe('when a public drive is created with `createPublicDrive`', () => {
@@ -727,7 +726,7 @@ describe('ArLocal Integration Tests', function () {
727726
});
728727

729728
describe('with a v2 public file transaction that has incomplete chunks', () => {
730-
it.skip('and a valid metadata tx, we can restore that tx using the file ID', async () => {
729+
it('and a valid metadata tx, we can restore that tx using the file ID', async () => {
731730
stub(fakeGatewayApi, 'postChunk').resolves();
732731

733732
const wrappedFile = stub2ChunkFileToUpload();
@@ -793,7 +792,8 @@ describe('ArLocal Integration Tests', function () {
793792
});
794793
});
795794

796-
it.skip('and a valid metadata tx, we can restore that tx using the parent folder ID', async () => {
795+
it('and a valid metadata tx, we can restore that tx using the parent folder ID', async () => {
796+
stub(fakeGatewayApi, 'postChunk').resolves();
797797
const wrappedFile = stub3ChunkFileToUpload();
798798

799799
// Upload file with `postChunk` method stubbed to RESOLVE without uploading
@@ -856,7 +856,7 @@ describe('ArLocal Integration Tests', function () {
856856
});
857857
});
858858

859-
it.skip('and NO valid metadata tx, we can restore that tx to an ArFS destination folder view', async () => {
859+
it('and NO valid metadata tx, we can restore that tx to an ArFS destination folder view', async () => {
860860
stub(fakeGatewayApi, 'postChunk').throws('Bad Error!');
861861

862862
const wrappedFile = stub258KiBFileToUpload();

tests/stubs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ export const stubEntitiesWithNoFilesWithPaths = stubEntitiesWithNoFiles.map((ent
462462
);
463463

464464
export const stubCommunityContract = {
465-
settings: [['fee', 50]],
465+
settings: [['fee', 15]],
466466
vault: { [`${stubArweaveAddress()}`]: [{ balance: 500, start: 1, end: 2 }] },
467467
balances: { [`${stubArweaveAddress()}`]: 200 }
468468
};

0 commit comments

Comments
 (0)