Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create identities.cs-e2e.ts #1411

Merged
merged 10 commits into from
Dec 12, 2024
Prev Previous commit
Next Next commit
Update transactions.cs-e2e.ts
cfaur09 committed Dec 5, 2024
commit 7359c1d8699dd0327653416b25ad4ea725f8e462
36 changes: 36 additions & 0 deletions src/test/chain-simulator/transactions.cs-e2e.ts
Original file line number Diff line number Diff line change
@@ -23,27 +23,43 @@ describe('Transactions e2e tests with chain simulator', () => {
const response = await axios.get(`${config.apiServiceUrl}/transactions?sender=${config.aliceAddress}`);
expect(response.status).toBe(200);
expect(response.data.length).toBeGreaterThan(1);

for (const transaction of response.data) {
expect(transaction.sender).toBe(config.aliceAddress);
}
});

it('should return transactions with receiver filter applied', async () => {
const receiver = 'erd1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq6gq4hu';
const response = await axios.get(`${config.apiServiceUrl}/transactions?receiver=${receiver}`);
expect(response.status).toBe(200);
expect(response.data.length).toBeGreaterThan(1);

for (const transaction of response.data) {
expect(transaction.receiver).toBe(receiver);
}
});

it('should return transactions with senderShard filter applied', async () => {
const senderShard = 0;
const response = await axios.get(`${config.apiServiceUrl}/transactions?senderShard=${senderShard}`);
expect(response.status).toBe(200);
expect(response.data.length).toBeGreaterThanOrEqual(1);

for (const transaction of response.data) {
expect(transaction.senderShard).toBe(senderShard);
}
});

it('should return transactions with receiverShard filter applied', async () => {
const receiverShard = 0;
const response = await axios.get(`${config.apiServiceUrl}/transactions?receiverShard=${receiverShard}`);
expect(response.status).toBe(200);
expect(response.data.length).toBeGreaterThanOrEqual(1);

for (const transaction of response.data) {
expect(transaction.receiverShard).toBe(receiverShard);
}
});

it('should return transactions with miniBlockHash filter applied', async () => {
@@ -52,6 +68,10 @@ describe('Transactions e2e tests with chain simulator', () => {
const response = await axios.get(`${config.apiServiceUrl}/transactions?miniBlockHash=${miniBlockHash}`);
expect(response.status).toBe(200);
expect(response.data.length).toStrictEqual(1);

for (const transaction of response.data) {
expect(transaction.miniBlockHash).toBe(miniBlockHash);
}
});

it('should return transactions with hashes filter applied', async () => {
@@ -60,18 +80,30 @@ describe('Transactions e2e tests with chain simulator', () => {
const response = await axios.get(`${config.apiServiceUrl}/transactions?hashes=${hashes}`);
expect(response.status).toBe(200);
expect(response.data.length).toStrictEqual(2);

for (const transaction of response.data) {
expect(hashes).toContain(transaction.txHash);
}
});

it('should return transactions with status filter applied', async () => {
const response = await axios.get(`${config.apiServiceUrl}/transactions?status=success`);
expect(response.status).toBe(200);
expect(response.data.length).toBeGreaterThanOrEqual(1);

for (const transaction of response.data) {
expect(transaction.status).toBe('success');
}
});

it('should return transactions with function filter applied', async () => {
const response = await axios.get(`${config.apiServiceUrl}/transactions?function=scDeploy`);
expect(response.status).toBe(200);
expect(response.data.length).toBeGreaterThanOrEqual(1);

for (const transaction of response.data) {
expect(transaction.function).toBe('scDeploy');
}
});

it('should return transactions with round filter applied', async () => {
@@ -80,6 +112,10 @@ describe('Transactions e2e tests with chain simulator', () => {
const response = await axios.get(`${config.apiServiceUrl}/transactions?round=${round}`);
expect(response.status).toBe(200);
expect(response.data.length).toBeGreaterThanOrEqual(1);

for (const transaction of response.data) {
expect(transaction.round).toBe(round);
}
});

it('should return transactions with withLogs filter applied and logs present', async () => {