Support live attribute restoration mechanics
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import type { AiMechanicAuthoringRequest } from '$lib/ai/mechanic-authoring';
|
||||
import {
|
||||
AI_MECHANIC_AUTHORING_INSTRUCTIONS,
|
||||
buildAiMechanicAuthoringInput
|
||||
} from './mechanic-authoring-prompt';
|
||||
|
||||
const request: AiMechanicAuthoringRequest = {
|
||||
context: {
|
||||
sourceKind: 'talent',
|
||||
sourceName: 'Predatory Aura',
|
||||
sourceDescription: 'Restore Health based on the current Firepower Multiplier.'
|
||||
},
|
||||
currentDraft: {
|
||||
version: 1,
|
||||
simulationReadiness: 'captured_only',
|
||||
scenarioInputs: [],
|
||||
pools: [],
|
||||
clauses: []
|
||||
},
|
||||
valueColumns: [
|
||||
{ key: 'tierI', variantKey: 'I', label: 'TIER I' },
|
||||
{ key: 'tierII', variantKey: 'II', label: 'TIER II' }
|
||||
],
|
||||
allowAssignedAbility: false,
|
||||
allowProtocolUpgradeScaling: false,
|
||||
transcript: []
|
||||
};
|
||||
|
||||
describe('AI mechanic authoring prompt', () => {
|
||||
it('advertises exact catalog Attribute references and displayed-percent semantics', () => {
|
||||
const input = JSON.parse(buildAiMechanicAuthoringInput({
|
||||
request,
|
||||
attributes: [{
|
||||
id: 'firepower-multiplier',
|
||||
name: 'Firepower Multiplier',
|
||||
description: null,
|
||||
unit: '%',
|
||||
type: null,
|
||||
category: null,
|
||||
calculationType: null
|
||||
}],
|
||||
events: [],
|
||||
actions: [],
|
||||
recipeKeys: []
|
||||
}));
|
||||
|
||||
expect(input.canonicalCatalog.grammar.valueReferences).toContain('attribute');
|
||||
expect(input.canonicalCatalog.grammar.referenceShapes).toContainEqual({
|
||||
ref: {
|
||||
source: 'attribute',
|
||||
attributeId: 'replace-with-an-exact-catalog-attribute-id'
|
||||
}
|
||||
});
|
||||
expect(input.examplesAndRules).toEqual(expect.arrayContaining([
|
||||
expect.stringContaining('exact supplied catalog ID'),
|
||||
expect.stringContaining('Divide that reference by 100')
|
||||
]));
|
||||
expect(AI_MECHANIC_AUTHORING_INSTRUCTIONS).toContain('Never invent an Attribute ID');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user