add journey tests for accDescription

This commit is contained in:
Kate Higa
2022-04-08 13:07:52 -07:00
parent 81b982ac20
commit 6b4eaa185e
2 changed files with 13 additions and 0 deletions

View File

@@ -36,6 +36,7 @@ describe('when using the journeyDb', function () {
fn | expected fn | expected
${'getTasks'} | ${[]} ${'getTasks'} | ${[]}
${'getTitle'} | ${''} ${'getTitle'} | ${''}
${'getAccDescription'} | ${''}
${'getSections'} | ${[]} ${'getSections'} | ${[]}
`('should clear $fn', ({ fn, expected }) => { `('should clear $fn', ({ fn, expected }) => {
expect(journeyDb[fn]()).toEqual(expected); expect(journeyDb[fn]()).toEqual(expected);
@@ -44,6 +45,7 @@ describe('when using the journeyDb', function () {
describe('tasks and actors should be added', function () { describe('tasks and actors should be added', function () {
journeyDb.setTitle('Shopping'); journeyDb.setTitle('Shopping');
journeyDb.setAccDescription('A user journey for family shopping');
journeyDb.addSection('Journey to the shops'); journeyDb.addSection('Journey to the shops');
journeyDb.addTask('Get car keys', ':5:Dad'); journeyDb.addTask('Get car keys', ':5:Dad');
journeyDb.addTask('Go to car', ':3:Dad, Mum, Child#1, Child#2'); journeyDb.addTask('Go to car', ':3:Dad, Mum, Child#1, Child#2');
@@ -52,6 +54,7 @@ describe('when using the journeyDb', function () {
journeyDb.addTask('Go shopping', ':5:Mum'); journeyDb.addTask('Go shopping', ':5:Mum');
expect(journeyDb.getTitle()).toEqual('Shopping'); expect(journeyDb.getTitle()).toEqual('Shopping');
expect(journeyDb.getAccDescription()).toEqual('A user journey for family shopping');
expect(journeyDb.getTasks()).toEqual([ expect(journeyDb.getTasks()).toEqual([
{ {
score: 5, score: 5,

View File

@@ -19,6 +19,16 @@ describe('when parsing a journey diagram it', function () {
expect(parserFnConstructor(str)).not.toThrow(); expect(parserFnConstructor(str)).not.toThrow();
}); });
it('it should handle an accDescription', function () {
const str =
'journey\n' +
'accDescription A user journey for family shopping\n'+
'title Adding journey diagram functionality to mermaid\n' +
'section Order from website';
expect(parserFnConstructor(str)).not.toThrow();
});
it('should handle a section definition', function () { it('should handle a section definition', function () {
const str = const str =
'journey\n' + 'journey\n' +