Skip to content

Commit

Permalink
test: fix test for passMode: onShowHint
Browse files Browse the repository at this point in the history
  • Loading branch information
vanilla-wave committed Sep 20, 2023
1 parent 6357248 commit 9102f7f
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 28 deletions.
7 changes: 1 addition & 6 deletions src/tests/hints.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,7 @@ describe('passMode onShowHint', function () {

const newState = options.onSave.progress.mock.calls[0][0];

expect(newState.presetPassedSteps.createProject).toEqual([
'openBoard',
'createSprint',
'createIssue',
'issueButtons',
]);
expect(newState.presetPassedSteps.createProject).toContain('issueButtons');
});

it('on one page with normal hint -> show first before close', async function () {
Expand Down
62 changes: 40 additions & 22 deletions src/tests/steps.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,32 +69,50 @@ describe('pass step', function () {
expect(snapshot.open).toBe(false);
});

it('passMode: "onShowHint": pass step -> dont hint', async function () {
const options = getOptions(
{},
{
presetPassedSteps: {
createProject: ['openBoard', 'createSprint', 'createIssue'],
},
},
);

options.config.presets.createProject.steps.push({
slug: 'issueButtons',
name: '',
description: '',
passMode: 'onShowHint',
});
describe('passMode: "onShowHint"', function () {
it('show hint step -> step passed hint', async function () {
const options = getOptions();

const controller = new Controller(options);
await controller.stepElementReached({
stepSlug: 'issueButtons',
element: getAnchorElement(),
options.config.presets.createProject.steps[1].passMode = 'onShowHint';

const controller = new Controller(options);
await controller.stepElementReached({
stepSlug: 'createSprint',
element: getAnchorElement(),
});

const newProgressState = options.onSave.progress.mock.calls[0][0];

expect(newProgressState.presetPassedSteps.createProject).toContain('createSprint');
});

const snapshot = controller.hintStore.getSnapshot();
it('show hint for last step -> finish preset', async function () {
const options = getOptions(
{},
{
presetPassedSteps: {
createProject: ['openBoard', 'createSprint', 'createIssue'],
},
},
);

options.config.presets.createProject.steps.push({
slug: 'issueButtons',
name: '',
description: '',
passMode: 'onShowHint',
});

expect(snapshot.open).toBe(true);
const controller = new Controller(options);
await controller.stepElementReached({
stepSlug: 'issueButtons',
element: getAnchorElement(),
});

const newProgressState = options.onSave.progress.mock.calls[0][0];

expect(newProgressState.finishedPresets).toContain('createProject');
});
});
});

Expand Down

0 comments on commit 9102f7f

Please sign in to comment.