Skip to content
This repository has been archived by the owner on Sep 16, 2024. It is now read-only.

chore(tests): add a test that validates bad smartweave tags are dis… #75

Merged
merged 1 commit into from
Nov 28, 2023
Merged
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
28 changes: 28 additions & 0 deletions tests/integration/routes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
// set a large timeout to 10 secs
this.timeout(10_000);
ids = [
process.env.DEPLOYED_ANT_CONTRACT_TX_ID!,

Check warning on line 49 in tests/integration/routes.test.ts

View workflow job for this annotation

GitHub Actions / build (lint:check)

Forbidden non-null assertion
process.env.DEPLOYED_REGISTRY_CONTRACT_TX_ID!,
];
id = process.env.DEPLOYED_REGISTRY_CONTRACT_TX_ID!;
Expand Down Expand Up @@ -177,6 +177,34 @@
expect(contractTxId).to.equal(id);
expect(interactions).to.deep.equal(contractInteractions);
});

it('should filter out poorly formatted interactions', async () => {
// deploy the manual constructed interaction
const badInteractionTx = await arweave.createTransaction(
{
data: Math.random().toString().slice(-4),
},
walletJWK,
);
badInteractionTx.addTag('App-Name', 'SmartWeaveAction');
badInteractionTx.addTag('Contract', id);
badInteractionTx.addTag(
'input',
JSON.stringify({ function: 'evolve', value: 'bad-interaction' }),
);

await arweave.transactions.sign(badInteractionTx, walletJWK);
await arweave.transactions.post(badInteractionTx);

const { status, data } = await axios.get(
`/v1/contract/${id}/interactions`,
);
expect(status).to.equal(200);
expect(data).to.not.be.undefined;
const { contractTxId, interactions } = data;
expect(contractTxId).to.equal(id);
expect(Object.keys(interactions)).not.to.contain(badInteractionTx.id);
});
});

describe('/:contractTxId/interactions/:address', () => {
Expand Down
Loading