Skip to content

Handle character choice from context #197

@dhowe

Description

@dhowe
it('Handle character choice in context', function () {
      const context = {
        lucy: {
          name: 'Lucy',
          pronoun: 'she',
          car: 'Lexus'
        },
        sam: {
          name: 'Sam',
          pronoun: 'he',
          car: 'Subaru'
        },
      };
      const script = {
        start: "Meet $person.name. $person.pronoun().cap drives a $person.car().",
        "#person": "$[sam | lucy]"
      };
      const res = RiGrammar.expand(script, context);
      console.log(res);
      expect(res).matches(/an ox(en)?/);
    });

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions