@inseefr/lunatic 3.12.3 → 3.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -572,6 +572,65 @@ describe('lunatic-variables-store', () => {
572
572
  variables.set('PRENOM', ['John', 'Jane']);
573
573
  expect(variables.get('AGE')).toEqual([null, null]);
574
574
  });
575
+ it('should check every iteration when configured from an iterated source change', () => {
576
+ // Given
577
+ variables.set('PRENOM', ['Marc', 'Marc', 'Marc']);
578
+ variables.set('QCU', ['A', 'B', 'B']);
579
+ cleaningBehaviour(
580
+ variables,
581
+ {
582
+ PRENOM: {
583
+ QCU: [
584
+ {
585
+ expression: 'PRENOM <> "Marc"',
586
+ shapeFrom: 'PRENOM',
587
+ isAggregatorUsed: false,
588
+ shouldCheckAllIterations: true,
589
+ },
590
+ ],
591
+ },
592
+ },
593
+ { PRENOM: [], QCU: [null] }
594
+ );
595
+
596
+ // When
597
+ variables.set('PRENOM', 'Patrick', { iteration: [0] });
598
+
599
+ // Then
600
+ expect(variables.get('QCU')).toEqual(['A', null, null]);
601
+ });
602
+ it('should handle simultaneously expressions that should check every iteration and expression that should not ', () => {
603
+ // Given
604
+ variables.set('PRENOM', ['Marc', 'Marc', 'Marc']);
605
+ variables.set('QCU', ['A', 'B', 'B']);
606
+ cleaningBehaviour(
607
+ variables,
608
+ {
609
+ PRENOM: {
610
+ QCU: [
611
+ {
612
+ expression: 'PRENOM <> ""',
613
+ shapeFrom: 'PRENOM',
614
+ isAggregatorUsed: false,
615
+ },
616
+ {
617
+ expression: 'PRENOM <> "Marc"',
618
+ shapeFrom: 'PRENOM',
619
+ isAggregatorUsed: false,
620
+ shouldCheckAllIterations: true,
621
+ },
622
+ ],
623
+ },
624
+ },
625
+ { PRENOM: [], QCU: [null] }
626
+ );
627
+
628
+ // When
629
+ variables.set('PRENOM', '', { iteration: [0] });
630
+
631
+ // Then
632
+ expect(variables.get('QCU')).toEqual([null, null, null]);
633
+ });
575
634
  it('should clean pairwise in two directions', () => {
576
635
  variables.set('LINKS', [
577
636
  [null, '1', '3'],