links-notation 0.11.0 → 0.11.2

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.
@@ -0,0 +1,128 @@
1
+ import { Parser } from '../src/Parser.js';
2
+ import { formatLinks } from '../src/Link.js';
3
+
4
+ describe('Indentation Consistency Tests (Issue #135)', () => {
5
+ let parser;
6
+
7
+ beforeEach(() => {
8
+ parser = new Parser();
9
+ });
10
+
11
+ test('leading spaces vs no leading spaces should produce same result', () => {
12
+ // Example with 2 leading spaces (from issue #135)
13
+ const withLeading = ` TELEGRAM_BOT_TOKEN: '849...355:AAG...rgk_YZk...aPU'
14
+ TELEGRAM_ALLOWED_CHATS:
15
+ -1002975819706
16
+ -1002861722681
17
+ TELEGRAM_HIVE_OVERRIDES:
18
+ --all-issues
19
+ --once
20
+ TELEGRAM_BOT_VERBOSE: true`;
21
+
22
+ // Example without leading spaces (from issue #135)
23
+ const withoutLeading = `TELEGRAM_BOT_TOKEN: '849...355:AAG...rgk_YZk...aPU'
24
+ TELEGRAM_ALLOWED_CHATS:
25
+ -1002975819706
26
+ -1002861722681
27
+ TELEGRAM_HIVE_OVERRIDES:
28
+ --all-issues
29
+ --once
30
+ TELEGRAM_BOT_VERBOSE: true`;
31
+
32
+ const resultWith = parser.parse(withLeading);
33
+ const resultWithout = parser.parse(withoutLeading);
34
+
35
+ // Compare the entire formatted output (complete round trip test)
36
+ expect(formatLinks(resultWith)).toBe(formatLinks(resultWithout));
37
+ });
38
+
39
+ test('two spaces vs four spaces indentation', () => {
40
+ // Example with 2 spaces per level
41
+ const twoSpaces = `TELEGRAM_BOT_TOKEN: '849...355:AAG...rgk_YZk...aPU'
42
+ TELEGRAM_ALLOWED_CHATS:
43
+ -1002975819706
44
+ -1002861722681
45
+ TELEGRAM_HIVE_OVERRIDES:
46
+ --all-issues
47
+ --once
48
+ --auto-fork
49
+ --skip-issues-with-prs
50
+ --attach-logs
51
+ --verbose
52
+ --no-tool-check
53
+ TELEGRAM_SOLVE_OVERRIDES:
54
+ --auto-fork
55
+ --auto-continue
56
+ --attach-logs
57
+ --verbose
58
+ --no-tool-check
59
+ TELEGRAM_BOT_VERBOSE: true`;
60
+
61
+ // Example with 4 spaces per level
62
+ const fourSpaces = `TELEGRAM_BOT_TOKEN: '849...355:AAG...rgk_YZk...aPU'
63
+ TELEGRAM_ALLOWED_CHATS:
64
+ -1002975819706
65
+ -1002861722681
66
+ TELEGRAM_HIVE_OVERRIDES:
67
+ --all-issues
68
+ --once
69
+ --auto-fork
70
+ --skip-issues-with-prs
71
+ --attach-logs
72
+ --verbose
73
+ --no-tool-check
74
+ TELEGRAM_SOLVE_OVERRIDES:
75
+ --auto-fork
76
+ --auto-continue
77
+ --attach-logs
78
+ --verbose
79
+ --no-tool-check
80
+ TELEGRAM_BOT_VERBOSE: true`;
81
+
82
+ const resultTwo = parser.parse(twoSpaces);
83
+ const resultFour = parser.parse(fourSpaces);
84
+
85
+ // Compare the entire formatted output (complete round trip test)
86
+ expect(formatLinks(resultTwo)).toBe(formatLinks(resultFour));
87
+ });
88
+
89
+ test('simple two vs four spaces indentation', () => {
90
+ // Simple example with 2 spaces
91
+ const twoSpaces = `parent:
92
+ child1
93
+ child2`;
94
+
95
+ // Simple example with 4 spaces
96
+ const fourSpaces = `parent:
97
+ child1
98
+ child2`;
99
+
100
+ const resultTwo = parser.parse(twoSpaces);
101
+ const resultFour = parser.parse(fourSpaces);
102
+
103
+ // Compare the entire formatted output (complete round trip test)
104
+ expect(formatLinks(resultTwo)).toBe(formatLinks(resultFour));
105
+ });
106
+
107
+ test('three level nesting with different indentation', () => {
108
+ // Three levels with 2 spaces
109
+ const twoSpaces = `level1:
110
+ level2:
111
+ level3a
112
+ level3b
113
+ level2b`;
114
+
115
+ // Three levels with 4 spaces
116
+ const fourSpaces = `level1:
117
+ level2:
118
+ level3a
119
+ level3b
120
+ level2b`;
121
+
122
+ const resultTwo = parser.parse(twoSpaces);
123
+ const resultFour = parser.parse(fourSpaces);
124
+
125
+ // Compare the entire formatted output (complete round trip test)
126
+ expect(formatLinks(resultTwo)).toBe(formatLinks(resultFour));
127
+ });
128
+ });