Skip to content
Merged
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
3 changes: 3 additions & 0 deletions packages/sdk/.env.integration
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SOROBAN_RPC_URL=http://localhost:8000
SOROBAN_NETWORK_PASSPHRASE=Standalone Network ; February 2017
TEST_SECRET_KEY=SBXXXXXXXXXXXXXXXXXXXXXXXX
37 changes: 37 additions & 0 deletions packages/sdk/src/__tests__/integration/deploy.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { describe, it, expect, beforeAll } from 'vitest';
import { ContractDeployer } from '../../ContractDeployer';
import { TEST_CONFIG } from './setup';

describe('Deployer Integration (Soroban)', () => {
let deployer: ContractDeployer;

beforeAll(() => {
deployer = new ContractDeployer({
rpcUrl: TEST_CONFIG.rpcUrl,
networkPassphrase: TEST_CONFIG.networkPassphrase,
});
});

it('should upload WASM successfully', async () => {
const wasmBuffer = Buffer.from([]); // replace with real wasm

const result = await deployer.uploadWasm(
wasmBuffer,
TEST_CONFIG.secretKey
);

expect(result.wasmHash).toBeDefined();
});

it('should deploy contract instance', async () => {
const wasmHash = 'SOME_HASH'; // from previous step

const result = await deployer.deployContract({
wasmHash,
signer: TEST_CONFIG.secretKey,
initParams: {},
});

expect(result.contractId).toBeDefined();
});
});
10 changes: 10 additions & 0 deletions packages/sdk/src/__tests__/integration/interaction.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { describe, it, expect } from 'vitest';

describe('Contract Interaction (Soroban)', () => {
it('should call contract method', async () => {
// Example placeholder
const response = true;

expect(response).toBe(true);
});
});
13 changes: 13 additions & 0 deletions packages/sdk/src/__tests__/integration/setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { config } from 'dotenv';

config({ path: '.env.integration' });

export const TEST_CONFIG = {
rpcUrl: process.env.SOROBAN_RPC_URL!,
networkPassphrase: process.env.SOROBAN_NETWORK_PASSPHRASE!,
secretKey: process.env.TEST_SECRET_KEY!,
};

if (!TEST_CONFIG.rpcUrl) {
throw new Error('Missing integration test config');
}
3 changes: 2 additions & 1 deletion packages/sdk/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export default defineConfig({
// Use `pnpm test:integration` (or `pnpm test:sdk:integration` from root) instead.
exclude: [
'src/__integration_tests__/**',
'src/**/__tests__/integration/**',
'**/node_modules/**',
],

Expand Down Expand Up @@ -54,4 +55,4 @@ export default defineConfig({
},
},
},
});
});
Loading