-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsandbox-testing.js
More file actions
39 lines (32 loc) · 1 KB
/
sandbox-testing.js
File metadata and controls
39 lines (32 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/**
* Sandbox mode testing
*
* This example shows how to use sandbox mode for unlimited testing
* without consuming your API quota.
*/
const { ConversionToolsClient } = require('conversiontools');
const apiToken = process.env.CONVERSION_TOOLS_API_TOKEN || 'your-api-token-here';
async function main() {
const client = new ConversionToolsClient({
apiToken,
});
try {
console.log('Testing conversion in SANDBOX mode (no quota used)...\n');
// Run conversion in sandbox mode
const outputPath = await client.convert({
type: 'convert.xml_to_csv',
input: './test.xml',
output: './test-result.csv',
options: {
sandbox: true, // ✨ This makes it a sandbox test
delimiter: 'comma',
},
});
console.log(`✓ Sandbox test complete! File saved to: ${outputPath}`);
console.log(' Note: This was a test conversion and did not use your quota.');
} catch (error) {
console.error('✗ Error:', error.message);
process.exit(1);
}
}
main();