1
0
Fork 0
mirror of https://github.com/betagouv/mon-entreprise synced 2025-02-09 05:15:02 +00:00
mon-entreprise/site/test/cycles.test.js
Maxime Quandalle 7db1a3394e Renomme le répertoire mon-entreprise/ en site/
Pour éviter l'arborescence `mon-entreprise/mon-entreprise` qui prêtait
à confusion
2021-12-02 13:06:45 +01:00

40 lines
1.3 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { expect } from 'chai'
import rules from 'modele-social'
import { utils } from 'publicodes'
describe('DottedNames graph', () => {
it("shouldn't have cycles", () => {
const [cyclesDependencies, dotGraphs] = utils.cyclicDependencies(rules)
const dotGraphsToLog = dotGraphs
.map(
(dotGraph) =>
`🌀🌀🌀🌀🌀🌀🌀🌀🌀🌀🌀\n A cycle graph to stare at with Graphviz:\n${dotGraph}\n\n`
)
.join('\n\n')
expect(
cyclesDependencies,
`${dotGraphsToLog}\nAT LEAST the following cycles have been found in the rules dependencies graph.\nSee below for a representation of each cycle.\n⬇️ is a node of the cycle.\n\t- ${cyclesDependencies
.map(
(cycleDependencies, idx) =>
'#' + idx + ':\n\t\t⬇ ' + cycleDependencies.join('\n\t\t⬇ ')
)
.join('\n\t- ')}\n\n`
).to.deep.equal([
[
'dirigeant . rémunération . imposable',
'dirigeant . auto-entrepreneur . impôt . revenu imposable',
"entreprise . chiffre d'affaires",
'dirigeant . rémunération . nette après impôt',
'dirigeant . rémunération . nette',
'dirigeant . rémunération . totale',
'impôt . montant',
'impôt . revenu imposable',
],
])
console.warn(
"[ WARNING ] A cycle still exists around `entreprise . chiffre d'affaires` see issue #1524 for a definitive fix."
)
})
})