feat: Banque des Coquillages v1.0 avec Docker et configuration NPM

This commit is contained in:
2026-11-11 21:18:25 +01:00
commit 4d7e5a01d0
26 changed files with 8779 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
import { handler } from './index.js';
function buildIntentEvent(intentName, slots = {}) {
const formattedSlots = {};
for (const [k, v] of Object.entries(slots)) {
formattedSlots[k] = { name: k, value: String(v) };
}
return {
version: '1.0',
session: { new: false, sessionId: 'SessionId.test', application: { applicationId: 'amzn1.ask.skill.test' } },
context: { System: { application: { applicationId: 'amzn1.ask.skill.test' } } },
request: {
type: 'IntentRequest',
requestId: 'EdwRequestId.test',
timestamp: new Date().toISOString(),
locale: 'fr-FR',
intent: {
name: intentName,
confirmationStatus: 'NONE',
slots: formattedSlots
}
}
};
}
async function runTests() {
console.log('🎙️ Test local du Skill Alexa "La Banque des Coquillages"...\n');
const tests = [
{ label: 'Solde de Violette', event: buildIntentEvent('GetBalanceIntent', { ChildName: 'Violette' }) },
{ label: 'Activités du mois', event: buildIntentEvent('ListActivitiesIntent', {}) },
{ label: 'Simulation intérêts (10 coquillages)', event: buildIntentEvent('SimulateInterestIntent', { ShellCount: 10 }) }
];
for (const t of tests) {
try {
const res = await new Promise((resolve, reject) => {
handler(t.event, {}, (err, response) => (err ? reject(err) : resolve(response)));
});
console.log(`✅ [${t.label}] ->`, res.response.outputSpeech.ssml);
} catch (e) {
console.error(`❌ [${t.label}] -> Erreur (assurez-vous que 'back' tourne sur le port 4000):`, e.message);
}
}
}
runTests();