diff --git a/Jenkinsfile b/Jenkinsfile index addce34..d8604ec 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -82,9 +82,12 @@ pipeline { mkdir -p "${BUILD_DIR}" uv sync --frozen ./scripts/build.sh + uv run python tools/export_monsters.py --id 2 --output "${BUILD_DIR}/example-monster-2.json" uv run python -m unittest discover -s tests -v if command -v node >/dev/null 2>&1; then - RAVENOUS_CHARACTER_JSON="${BUILD_DIR}/example-character.json" node tests/test_character_io.mjs + RAVENOUS_CHARACTER_JSON="${BUILD_DIR}/example-character.json" \ + RAVENOUS_MONSTER_JSON="${BUILD_DIR}/example-monster-2.json" \ + node tests/test_character_io.mjs node tests/test_craft_import.mjs else echo 'Node is not installed on this agent; skipping the optional Roll20 Mod simulator tests.' @@ -99,6 +102,7 @@ pipeline { test -f "${BUILD_DIR}/example-character.json" test -f "${BUILD_DIR}/example-craft-forge.json" test -f "${BUILD_DIR}/example-craft-alchemy.json" + test -f "${BUILD_DIR}/example-monster-2.json" echo "Roll20 sheet build complete:" ls -lh "${BUILD_DIR}" diff --git a/README.md b/README.md index dcafbca..30cc406 100644 --- a/README.md +++ b/README.md @@ -187,6 +187,9 @@ l'importe dans le simulateur de l'API Mod lorsque Node est disponible sur l'agent ; l'absence de ce runtime n'empêche pas la construction de la feuille. Le script `./scripts/build.sh` génère automatiquement ce même exemple dans son dossier de sortie, et `./scripts/build.sh --check` vérifie également son contenu. +Jenkins exporte en plus le monstre d'ID 2 (`Yajjpnir`) dans +`build/example-monster-2.json`, l'archive, puis l'importe avec le même simulateur +pour vérifier les localisations, attaques et pouvoirs générés. Le build génère aussi deux charges utiles prêtes à importer : `build/example-craft-forge.json` (attaque et protection) et diff --git a/tests/test_build.py b/tests/test_build.py index 74b59d4..76da375 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -18,7 +18,8 @@ class BuildTests(unittest.TestCase): actual = {path.name for path in (ROOT / "build").iterdir()} self.assertTrue(expected.issubset(actual)) self.assertLessEqual(actual - expected, { - "example-character.json", "example-craft-forge.json", "example-craft-alchemy.json" + "example-character.json", "example-craft-forge.json", "example-craft-alchemy.json", + "example-monster-2.json" }) def test_source_data_was_imported(self): diff --git a/tests/test_character_io.mjs b/tests/test_character_io.mjs index f085b79..83321f8 100644 --- a/tests/test_character_io.mjs +++ b/tests/test_character_io.mjs @@ -167,12 +167,12 @@ test('a converted database monster imports with its body parts and abilities', const handout = game.createObj('handout', { gmnotes: `
${JSON.stringify(data).replace(/&/g, '&').replace(//g, '>')}
` }); game.send(`!ravenous-import --handout ${handout.id}`); const character = [...game.objects.values()].find(obj => obj.type === 'character'); - assert.equal(character.get('name'), 'Arangar'); + assert.equal(character.get('name'), data.name); const attrs = [...game.objects.values()].filter(obj => obj.type === 'attribute' && obj.get('characterid') === character.id); assert.equal(attrs.length, data.attributes.length); - assert.ok(attrs.some(obj => obj.get('name') === 'repeating_locations_dbpart1_name' && obj.get('current') === 'Tête')); - assert.ok(attrs.some(obj => obj.get('name') === 'repeating_attacks_dbability5_name')); - assert.ok(attrs.some(obj => obj.get('name') === 'repeating_powers_dbability1_name')); + assert.ok(attrs.some(obj => /^repeating_locations_dbpart\d+_name$/.test(obj.get('name')))); + assert.ok(attrs.some(obj => /^repeating_attacks_dbability\d+_name$/.test(obj.get('name')))); + assert.ok(attrs.some(obj => /^repeating_powers_dbability\d+_name$/.test(obj.get('name')))); }); test('a generated fuzz character imports with all representative repeating sections',