discord-music-bot/tests/start-script.test.ts
aki 3c4dc51855 refactor: Convert project from JavaScript to TypeScript
- Converted all .js files to .ts
- Added TypeScript configuration (tsconfig.json)
- Added ESLint and Prettier configuration
- Updated package.json dependencies
- Modified Docker and application configurations
2025-04-24 13:48:10 +08:00

11 lines
527 B
TypeScript

const { spawnSync } = require('child_process');
describe('NPM Start Script', () => {
test('npm start exits without error when DISCORD_TOKEN is provided', () => {
const env = { ...process.env, DISCORD_TOKEN: 'dummy-token', CLIENT_ID: '123', LAVALINK_HOST: 'localhost', LAVALINK_PORT: '2333', LAVALINK_PASSWORD: 'pass' };
const result = spawnSync('pnpm', ['start'], { env, encoding: 'utf-8' });
// The script starts the bot; if it reaches login attempt, exit code is 0
expect(result.status).toBe(0);
});
});