This commit is contained in:
2025-07-18 11:42:06 +00:00
parent f530fa639a
commit 4ec2e46c4b
5 changed files with 70 additions and 23 deletions

View File

@@ -9,26 +9,19 @@ let testBunqAccount: bunq.BunqAccount;
let sandboxApiKey: string;
tap.test('should create a sandbox API key when needed', async () => {
// Check if we have an API key from environment
const envApiKey = await testQenv.getEnvVarOnDemand('BUNQ_APIKEY');
// Always create a new sandbox user for testing to avoid expired keys
const tempAccount = new bunq.BunqAccount({
apiKey: '',
deviceName: 'bunq-test-generator',
environment: 'SANDBOX',
});
if (!envApiKey) {
// Create a temporary bunq account to generate sandbox API key
const tempAccount = new bunq.BunqAccount({
apiKey: '',
deviceName: 'bunq-test-generator',
environment: 'SANDBOX',
});
sandboxApiKey = await tempAccount.createSandboxUser();
console.log('Generated new sandbox API key');
} else {
sandboxApiKey = envApiKey;
console.log('Using existing API key from environment');
}
sandboxApiKey = await tempAccount.createSandboxUser();
console.log('Generated new sandbox API key:', sandboxApiKey);
expect(sandboxApiKey).toBeTypeofString();
expect(sandboxApiKey.length).toBeGreaterThan(0);
expect(sandboxApiKey).toInclude('sandbox_');
});
tap.test('should create a valid bunq account', async () => {