@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | use Pratiksh\Nepalidate\Tests\Unit\Doubles\DateConverterTestDouble; |
6 | 6 | |
7 | -test('date converter has correct bs month in english', function () { |
|
7 | +test('date converter has correct bs month in english', function() { |
|
8 | 8 | $converter = new DateConverterTestDouble(); |
9 | 9 | |
10 | 10 | expect($converter->getBSMonthInEnglish(1))->toBe('Baisakh') |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | ->and($converter->getBSMonthInEnglish(12))->toBe('Chaitra'); |
13 | 13 | }); |
14 | 14 | |
15 | -test('date converter has correct bs month in nepali', function () { |
|
15 | +test('date converter has correct bs month in nepali', function() { |
|
16 | 16 | $converter = new DateConverterTestDouble(); |
17 | 17 | |
18 | 18 | expect($converter->getBSMonthInNepali(1))->toBe('वैशाख') |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | ->and($converter->getBSMonthInNepali(12))->toBe('चैत'); |
21 | 21 | }); |
22 | 22 | |
23 | -test('date converter has correct ad month in nepali', function () { |
|
23 | +test('date converter has correct ad month in nepali', function() { |
|
24 | 24 | $converter = new DateConverterTestDouble(); |
25 | 25 | |
26 | 26 | expect($converter->getADMonthInNepali(1))->toBe('जनवरी') |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | ->and($converter->getADMonthInNepali(12))->toBe('दिसेम्बर'); |
29 | 29 | }); |
30 | 30 | |
31 | -test('date converter has correct day of week in nepali', function () { |
|
31 | +test('date converter has correct day of week in nepali', function() { |
|
32 | 32 | $converter = new DateConverterTestDouble(); |
33 | 33 | |
34 | 34 | expect($converter->getDayOfWeekInNepali(1))->toBe('आइतवार') |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | ->and($converter->getDayOfWeekInNepali(7))->toBe('शनिवार'); |
37 | 37 | }); |
38 | 38 | |
39 | -test('date converter has correct day of week in english', function () { |
|
39 | +test('date converter has correct day of week in english', function() { |
|
40 | 40 | $converter = new DateConverterTestDouble(); |
41 | 41 | |
42 | 42 | expect($converter->getDayOfWeekInEnglish(1))->toBe('Sunday') |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | ->and($converter->getDayOfWeekInEnglish(7))->toBe('Saturday'); |
45 | 45 | }); |
46 | 46 | |
47 | -test('date converter has correct numbers in nepali', function () { |
|
47 | +test('date converter has correct numbers in nepali', function() { |
|
48 | 48 | $converter = new DateConverterTestDouble(); |
49 | 49 | |
50 | 50 | expect($converter->getNumbersInNepali(0))->toBe('०') |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | ->and($converter->getNumbersInNepali(9))->toBe('९'); |
53 | 53 | }); |
54 | 54 | |
55 | -test('date converter formats nepali numbers correctly', function () { |
|
55 | +test('date converter formats nepali numbers correctly', function() { |
|
56 | 56 | $converter = new DateConverterTestDouble(); |
57 | 57 | |
58 | 58 | expect($converter->formattedNepaliNumber('123'))->toBe('१२३') |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | ->and($converter->formattedNepaliNumber('9876543210'))->toBe('९८७६५४३२१०'); |
61 | 61 | }); |
62 | 62 | |
63 | -test('date converter validates english date range correctly', function () { |
|
63 | +test('date converter validates english date range correctly', function() { |
|
64 | 64 | $converter = new DateConverterTestDouble(); |
65 | 65 | |
66 | 66 | // Valid dates should pass should return true |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | expect($converter->isInRangeEng(2000, 6, 32))->toBeFalse(); |
77 | 77 | }); |
78 | 78 | |
79 | -test('date converter validates nepali date range correctly', function () { |
|
79 | +test('date converter validates nepali date range correctly', function() { |
|
80 | 80 | $converter = new DateConverterTestDouble(); |
81 | 81 | |
82 | 82 | // Valid dates |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | expect($converter->isInRangeNep(2080, 6, 33))->toBeFalse(); |
93 | 93 | }); |
94 | 94 | |
95 | -test('date converter correctly identifies leap years', function () { |
|
95 | +test('date converter correctly identifies leap years', function() { |
|
96 | 96 | $converter = new DateConverterTestDouble(); |
97 | 97 | |
98 | 98 | // Leap years |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | expect($converter->isLeapYear(2022))->toBeFalse(); // Not divisible by 4 |
108 | 108 | }); |
109 | 109 | |
110 | -test('date converter calculates total english days correctly', function () { |
|
110 | +test('date converter calculates total english days correctly', function() { |
|
111 | 111 | $converter = new DateConverterTestDouble(); |
112 | 112 | |
113 | 113 | // Starting date used in calculations (1944-01-01 corresponds to day 1) |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | expect($converter->getTotalEnglishDays(2022, 1, 1))->toBe($daysFrom1944To2022 + 1); |
137 | 137 | }); |
138 | 138 | |
139 | -test('date converter calculates total nepali days correctly', function () { |
|
139 | +test('date converter calculates total nepali days correctly', function() { |
|
140 | 140 | $converter = new DateConverterTestDouble(); |
141 | 141 | $calendarData = $converter->getCalendarData(); |
142 | 142 | |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | expect($converter->getTotalNepaliDays($targetYear, $targetMonth, $targetDay))->toBe($totalDays); |
185 | 185 | }); |
186 | 186 | |
187 | -test('calendar data is correctly structured', function () { |
|
187 | +test('calendar data is correctly structured', function() { |
|
188 | 188 | $converter = new DateConverterTestDouble(); |
189 | 189 | $calendarData = $converter->getCalendarData(); |
190 | 190 |
@@ -3,35 +3,35 @@ |
||
3 | 3 | use Carbon\Carbon; |
4 | 4 | use Pratiksh\Nepalidate\Services\EnglishDate; |
5 | 5 | |
6 | -test('it converts BS date string to AD using create()', function () { |
|
6 | +test('it converts BS date string to AD using create()', function() { |
|
7 | 7 | $date = EnglishDate::create('2081-01-01'); |
8 | 8 | |
9 | 9 | expect($date)->toBeInstanceOf(EnglishDate::class); |
10 | 10 | expect($date->toCarbon()->format('Y-m-d'))->toBe('2024-04-13'); |
11 | 11 | }); |
12 | 12 | |
13 | -test('it converts BS date string to AD using fromBS()', function () { |
|
13 | +test('it converts BS date string to AD using fromBS()', function() { |
|
14 | 14 | $date = EnglishDate::fromBS('2081/01/01'); |
15 | 15 | |
16 | 16 | expect($date)->toBeInstanceOf(EnglishDate::class); |
17 | 17 | expect($date->toCarbon()->format('Y-m-d'))->toBe('2024-04-13'); |
18 | 18 | }); |
19 | 19 | |
20 | -test('it throws exception for invalid date format in create()', function () { |
|
20 | +test('it throws exception for invalid date format in create()', function() { |
|
21 | 21 | $this->expectException(Exception::class); |
22 | 22 | $this->expectExceptionMessage('Invalid date format'); |
23 | 23 | |
24 | 24 | EnglishDate::create('2081-01'); |
25 | 25 | }); |
26 | 26 | |
27 | -test('it throws exception for invalid date format in fromBS()', function () { |
|
27 | +test('it throws exception for invalid date format in fromBS()', function() { |
|
28 | 28 | $this->expectException(Exception::class); |
29 | 29 | $this->expectExceptionMessage('Invalid date format'); |
30 | 30 | |
31 | 31 | EnglishDate::fromBS('2081/01'); |
32 | 32 | }); |
33 | 33 | |
34 | -test('it correctly sets AD Carbon date after conversion', function () { |
|
34 | +test('it correctly sets AD Carbon date after conversion', function() { |
|
35 | 35 | $bs = '2081-01-01'; |
36 | 36 | $englishDate = EnglishDate::create($bs); |
37 | 37 | $carbon = $englishDate->toCarbon(); |