updated test to match with new proficiency objects
This commit is contained in:
@@ -5,29 +5,43 @@ var getEffect = function(charId, op, value){
|
|||||||
var getAttributeEffect = function(charId, attribute, op, value){
|
var getAttributeEffect = function(charId, attribute, op, value){
|
||||||
return {
|
return {
|
||||||
charId: charId,
|
charId: charId,
|
||||||
type: "inate",
|
|
||||||
stat: attribute,
|
stat: attribute,
|
||||||
operation: op,
|
operation: op,
|
||||||
value: value,
|
value: value,
|
||||||
parent: {
|
parent: {
|
||||||
id: charId,
|
id: charId,
|
||||||
collection: "Characters"
|
collection: "Characters",
|
||||||
|
group: "inate",
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
var getSkillEffect = function(charId, op, value){
|
var getSkillEffect = function(charId, op, value){
|
||||||
return {
|
return {
|
||||||
charId: charId,
|
charId: charId,
|
||||||
type: "inate",
|
|
||||||
stat: "athletics",
|
stat: "athletics",
|
||||||
operation: op,
|
operation: op,
|
||||||
value: value,
|
value: value,
|
||||||
parent: {
|
parent: {
|
||||||
id: charId,
|
id: charId,
|
||||||
collection: "Characters"
|
collection: "Characters",
|
||||||
|
group: "inate",
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
var getProficiency = function(charId, value){
|
||||||
|
return {
|
||||||
|
charId: charId,
|
||||||
|
value: value,
|
||||||
|
type: "skill",
|
||||||
|
name: "athletics",
|
||||||
|
parent: {
|
||||||
|
id: charId,
|
||||||
|
collection: "Characters",
|
||||||
|
group: "inate",
|
||||||
|
}
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!(typeof MochaWeb === 'undefined')){
|
if (!(typeof MochaWeb === 'undefined')){
|
||||||
@@ -118,19 +132,19 @@ if (!(typeof MochaWeb === 'undefined')){
|
|||||||
beforeEach(function(){
|
beforeEach(function(){
|
||||||
Effects.remove({});
|
Effects.remove({});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should get its base value from the ability mod", function(){
|
it("should get its base value from the ability mod", function(){
|
||||||
Effects.insert(getAttributeEffect(charId, "strength", "base", 16));
|
Effects.insert(getAttributeEffect(charId, "strength", "base", 16));
|
||||||
chai.assert.equal(3, strMod());
|
chai.assert.equal(3, strMod());
|
||||||
chai.assert.equal(3, ath());
|
chai.assert.equal(3, ath());
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should add a multiple of proficiency bonus", function(){
|
it("should add a multiple of proficiency bonus", function(){
|
||||||
Effects.insert(getAttributeEffect(charId, "strength", "base", 16));
|
Effects.insert(getAttributeEffect(charId, "strength", "base", 16));
|
||||||
Effects.insert(getAttributeEffect(charId, "proficiencyBonus", "base", 7));
|
Effects.insert(getAttributeEffect(charId, "proficiencyBonus", "base", 7));
|
||||||
chai.assert.equal(7, char.attributeValue("proficiencyBonus"), "the proficiency bonus is calculated correctly");
|
chai.assert.equal(7, char.attributeValue("proficiencyBonus"), "the proficiency bonus is calculated correctly");
|
||||||
Effects.insert(getSkillEffect(charId, "proficiency", 0.5));
|
Proficiencies.insert(getProficiency(charId, 0.5));
|
||||||
Effects.insert(getSkillEffect(charId, "proficiency", 2));
|
Proficiencies.insert(getProficiency(charId, 2));
|
||||||
chai.assert.equal(17, ath(), "3 strength + (7 x 2) proficiency bonus");
|
chai.assert.equal(17, ath(), "3 strength + (7 x 2) proficiency bonus");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user