Skip to content

Commit ae82985

Browse files
committed
refactor(chatbot): fonctions utilitaires secondaires pour le parse du Markdown déplacées dans parsers/helpers/
1 parent 79fe802 commit ae82985

10 files changed

Lines changed: 11 additions & 9 deletions

File tree

app/js/core/chatbot/parseMarkdown.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { removeYaml } from "./parsers/removeYaml.mjs";
1+
import { removeYaml } from "./parsers/helpers/removeYaml.mjs";
22
import {
33
extractIntroduction,
44
extractInformationsFromInitialMessage,

app/js/core/chatbot/parsers/extractIntroduction.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { detectChoiceOption } from "./detectChoiceOption.mjs";
1+
import { detectChoiceOption } from "./helpers/detectChoiceOption.mjs";
22

33
export function extractIntroduction(mdWithoutYaml) {
44
// On récupère la séparation entre la première partie des données (titre + message principal) et la suite avec les réponses possibles

app/js/core/chatbot/parsers/extractMainContent.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { detectChoiceOption } from "./detectChoiceOption.mjs";
2-
import { detectedResponseTitle } from "./detectResponseTitle.mjs";
1+
import { detectChoiceOption } from "./helpers/detectChoiceOption.mjs";
2+
import { detectedResponseTitle } from "./helpers/detectResponseTitle.mjs";
33
import {
44
handleNewResponseTitle,
55
handleKeywords,

app/js/core/chatbot/parsers/detectChoiceOption.mjs renamed to app/js/core/chatbot/parsers/helpers/detectChoiceOption.mjs

File renamed without changes.

app/js/core/chatbot/parsers/detectResponseTitle.mjs renamed to app/js/core/chatbot/parsers/helpers/detectResponseTitle.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { startsWithAnyOf } from "../../../utils/strings.mjs";
1+
import { startsWithAnyOf } from "../../../../utils/strings.mjs";
22

33
export function detectedResponseTitle(line, yaml) {
44
return startsWithAnyOf(line, yaml.responsesTitles);

app/js/core/chatbot/parsers/helpers/processorsMainContent.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {
22
detectedResponseTitle,
33
isStructureTitle,
4-
} from "../detectResponseTitle.mjs";
4+
} from "./detectResponseTitle.mjs";
55

66
const regexDynamicContentIfBlock = /`if (.*?)`/;
77

File renamed without changes.

app/script.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/unit/core/chatbot/parsers/detectChoiceOption.spec.mjs renamed to tests/unit/core/chatbot/parsers/helpers/detectChoiceOption.spec.mjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { detectChoiceOption } from "../../../../../app/js/core/chatbot/parsers/detectChoiceOption.mjs";
1+
import { detectChoiceOption } from "../../../../../../app/js/core/chatbot/parsers/helpers/detectChoiceOption.mjs";
22

33
describe("detectChoiceOption", () => {
44
it("detects ordered list line with a link starting with a dot (in Markdown), as a non-random choice option", () => {
@@ -67,6 +67,8 @@ describe("detectChoiceOption", () => {
6767
expect(result1.isRandom).toBeFalse();
6868
expect(result2.isChoice).toBeFalse();
6969
expect(result2.isRandom).toBeFalse();
70+
expect(result3.isChoice).toBeTrue();
71+
expect(result3.isRandom).toBeFalse();
7072
expect(result4.isChoice).toBeFalse();
7173
expect(result4.isRandom).toBeFalse();
7274
});

tests/unit/core/chatbot/parsers/detectResponseTitles.spec.mjs renamed to tests/unit/core/chatbot/parsers/helpers/detectResponseTitles.spec.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {
22
getStructureTitles,
33
isStructureTitle,
4-
} from "../../../../../app/js/core/chatbot/parsers/detectResponseTitle.mjs";
4+
} from "../../../../../../app/js/core/chatbot/parsers/helpers/detectResponseTitle.mjs";
55

66
describe("structureTitles", () => {
77
it("returns empty array when yaml is undefined", () => {

0 commit comments

Comments
 (0)