update
This commit is contained in:
25
test/test.ts
25
test/test.ts
@@ -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 () => {
|
||||
|
Reference in New Issue
Block a user