Bona Iqiniso Application Board

V3BiStakeholderBase

Specification for V3BiStakeholderBase

Attributes

AttributeTypeDescription
referencestringUnique identifier for the stakeholder
descriptionV3BiTranslationBase[]Array of translations describing the stakeholder in different languages
influencedByV3BiInfluenceBase[]Array of influences that affect the stakeholder, optional, defaults to an empty array

Methods

MethodDescription
constructorInitializes a new instance of V3BiStakeholderBase with the provided reference, description, and optionally influencedBy array. Defaults influencedBy to an empty array if not provided.
getStakeholderReturns the stakeholder description in the specified language, or ‘unknown stakeholder description’ if the translation is not found.

Constructor

Signature:

constructor(reference: string, description: V3BiTranslationBase[], influencedBy?: V3BiInfluenceBase[])

Parameters:

  • reference (string): Unique identifier for the stakeholder.
  • description (V3BiTranslationBase[]): Array of translations describing the stakeholder.
  • influencedBy (V3BiInfluenceBase[], optional): Array of influences that affect the stakeholder.

Description:
The constructor initializes the V3BiStakeholderBase instance with the provided reference, description, and optionally influencedBy. If influencedBy is not provided, it defaults to an empty array.

Method: getStakeholder

Signature:

getStakeholder(language: string): string

Parameters:

  • language (string): The language code for which the stakeholder description is requested.

Description:
Returns the stakeholder description in the specified language, or ‘unknown stakeholder description’ if the translation is not found.

Example Usage

const translations = [
  new V3BiTranslationBase('en', 'Stakeholder description in English'),
  new V3BiTranslationBase('es', 'Descripción del stakeholder en español')
];
const influences = [
  new V3BiInfluenceBase('influence1'),
  new V3BiInfluenceBase('influence2')
];
const stakeholder = new V3BiStakeholderBase('stakeholder1', translations, influences);
console.log(stakeholder.getStakeholder('en')); // Output: Stakeholder description in English
console.log(stakeholder.getStakeholder('fr')); // Output: unknown stakeholder description

Scenario Table

ScenarioGivenWhenThen
Create an instance with all attributesThe reference is 'stakeholder1', description is a valid array, and influencedBy is a valid arrayI create a new V3BiStakeholderBase with reference, description, and influencedByThe instance should be created with the specified attributes
Create an instance with an empty influencedBy arrayThe reference is 'stakeholder2' and description is a valid arrayI create a new V3BiStakeholderBase with reference and descriptionThe instance should be created with influencedBy as an empty array
Return the correct stakeholder description for a languageThe reference is 'stakeholder3' and description is a valid arrayI call getStakeholder with a valid language codeThe correct stakeholder description for the given language should be returned
Return “unknown stakeholder description” if the language does not existThe reference is 'stakeholder4' and description is a valid arrayI call getStakeholder with an invalid language codeThe message ‘unknown stakeholder description’ should be returned
Handle empty influencedBy arrayThe reference is 'stakeholder5', description is a valid array, and influencedBy is an empty arrayI create a new V3BiStakeholderBase with reference, description, and an empty influencedByThe instance should be created with influencedBy as an empty array and the description and reference should be as provided