refactor: migrate testing framework from Karma/Jasmine to Vitest with Angular support
This commit is contained in:
1 parent
237d995e16
commit
11924df19e
14 files changed
+1351
-273
No files matched your search
@@ -33,7 +33,7 @@ describe('RulesPanel', () => {
|
||||
it('should start adding new If-Then rule', () => {
|
||||
component.startAddNew(RuleType.IF_THEN);
|
||||
|
||||
expect(component['isAddingNew']()).toBeTrue();
|
||||
expect(component['isAddingNew']()).toBe(true);
|
||||
expect(component['newRuleType']()).toBe(RuleType.IF_THEN);
|
||||
expect(component['editBuffer'].type).toBe(RuleType.IF_THEN);
|
||||
expect(component['editBuffer'].name).toBe('Nouvelle Règle');
|
||||
@@ -42,7 +42,7 @@ describe('RulesPanel', () => {
|
||||
it('should start adding new Time Window rule', () => {
|
||||
component.startAddNew(RuleType.TIME_WINDOW);
|
||||
|
||||
expect(component['isAddingNew']()).toBeTrue();
|
||||
expect(component['isAddingNew']()).toBe(true);
|
||||
expect(component['newRuleType']()).toBe(RuleType.TIME_WINDOW);
|
||||
expect(component['editBuffer'].type).toBe(RuleType.TIME_WINDOW);
|
||||
expect(component['editBuffer'].name).toBe('Nouvelle Période');
|
||||
@@ -52,7 +52,7 @@ describe('RulesPanel', () => {
|
||||
component.startAddNew(RuleType.IF_THEN);
|
||||
component.cancelEdit();
|
||||
|
||||
expect(component['isAddingNew']()).toBeFalse();
|
||||
expect(component['isAddingNew']()).toBe(false);
|
||||
expect(component['editingRuleId']()).toBeNull();
|
||||
expect(Object.keys(component['editBuffer']).length).toBe(0);
|
||||
});
|
||||
@@ -65,7 +65,7 @@ describe('RulesPanel', () => {
|
||||
component.saveEdit();
|
||||
|
||||
expect(component.rules.length).toBe(initialCount + 1);
|
||||
expect(component.rules.some((r) => r.name === 'Custom Test Rule')).toBeTrue();
|
||||
expect(component.rules.some((r) => r.name === 'Custom Test Rule')).toBe(true);
|
||||
});
|
||||
|
||||
it('should update an existing rule', () => {
|
||||
@@ -89,7 +89,7 @@ describe('RulesPanel', () => {
|
||||
component.deleteRule(targetId, mockEvent);
|
||||
|
||||
expect(component.rules.length).toBe(initialCount - 1);
|
||||
expect(component.rules.some((r) => r.id === targetId)).toBeFalse();
|
||||
expect(component.rules.some((r) => r.id === targetId)).toBe(false);
|
||||
});
|
||||
|
||||
it('should toggle a rule', () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Component, ChangeDetectionStrategy, inject, signal } from '@angular/core';
|
||||
import { Component, ChangeDetectionStrategy, inject, signal, Injectable } from '@angular/core';
|
||||
import {
|
||||
RuleService,
|
||||
RuleType,
|
||||
@@ -26,6 +26,7 @@ import {
|
||||
} from '@angular/material/core';
|
||||
import { CdkDragDrop, CdkDropList, CdkDrag } from '@angular/cdk/drag-drop';
|
||||
|
||||
@Injectable()
|
||||
class CustomDateAdapter extends NativeDateAdapter {
|
||||
override format(date: Date, displayFormat: unknown): string {
|
||||
if (displayFormat === 'input') {
|
||||
|
||||
Reference in new issue
Block a user