1
1
Import-Module " $PSScriptRoot \..\PowerShellAI.psd1" - Force
2
2
3
- Describe " ConvertFrom-GPTMarkdownTable" {
3
+ Describe " ConvertFrom-GPTMarkdownTable" - Tag GPTMarkdownTable {
4
4
It " ConvertFrom-GPTMarkdownTable" {
5
5
$markdown = @"
6
6
| p1 | p2 | p3 |
7
7
| --- | --- | --- |
8
8
| 1 | 2 | 3 |
9
9
| 4 | 5 | 6 |
10
10
"@
11
- $actual = ConvertFrom-GPTMarkdownTable $markdown
11
+ $actual = ConvertFrom-GPTMarkdownTable $markdown.Trim ()
12
12
13
13
$actual | Should -Not - BeNullOrEmpty
14
14
15
15
$actual.Count | Should - Be 2
16
16
$names = $actual [0 ].psobject.Properties.Name
17
17
18
18
$names.Count | Should - Be 3
19
- $names [0 ] | Should - Be ' p1 '
20
- $names [1 ] | Should - Be ' p2 '
21
- $names [2 ] | Should - Be ' p3 '
19
+ $names [0 ] | Should - Be ' p1'
20
+ $names [1 ] | Should - Be ' p2'
21
+ $names [2 ] | Should - Be ' p3'
22
+
22
23
23
- $actual [0 ].' p1 ' | Should - Be 1
24
- $actual [0 ].' p2 ' | Should - Be 2
25
- $actual [0 ].' p3 ' | Should - Be 3
24
+ $actual [0 ].' p1' | Should - Be 1
25
+ $actual [0 ].' p2' | Should - Be 2
26
+ $actual [0 ].' p3' | Should - Be 3
26
27
27
- $actual [1 ].' p1 ' | Should - Be 4
28
- $actual [1 ].' p2 ' | Should - Be 5
29
- $actual [1 ].' p3 ' | Should - Be 6
28
+ $actual [1 ].' p1' | Should - Be 4
29
+ $actual [1 ].' p2' | Should - Be 5
30
+ $actual [1 ].' p3' | Should - Be 6
30
31
31
32
}
32
33
@@ -50,22 +51,22 @@ Celery | 16 | 0 | 3 | 0
50
51
$names = $actual [0 ].psobject.Properties.Name
51
52
52
53
$names.Count | Should - Be 5
53
- $names [0 ] | Should - Be ' Vegetable '
54
- $names [1 ] | Should - Be ' Calories '
55
- $names [2 ] | Should - Be ' Protein (g) '
56
- $names [3 ] | Should - Be ' Carbs (g) '
54
+ $names [0 ] | Should - Be ' Vegetable'
55
+ $names [1 ] | Should - Be ' Calories'
56
+ $names [2 ] | Should - Be ' Protein (g)'
57
+ $names [3 ] | Should - Be ' Carbs (g)'
57
58
$names [4 ] | Should - Be ' Fat (g)'
58
59
59
- $actual [0 ].' Vegetable ' | Should - Be ' Carrot '
60
- $actual [0 ].' Calories ' | Should - Be 41
61
- $actual [0 ].' Protein (g) ' | Should - Be 1
62
- $actual [0 ].' Carbs (g) ' | Should - Be 9
60
+ $actual [0 ].' Vegetable' | Should - Be ' Carrot'
61
+ $actual [0 ].' Calories' | Should - Be 41
62
+ $actual [0 ].' Protein (g)' | Should - Be 1
63
+ $actual [0 ].' Carbs (g)' | Should - Be 9
63
64
$actual [0 ].' Fat (g)' | Should - Be 0
64
65
65
- $actual [-1 ].' Vegetable ' | Should - Be ' Celery '
66
- $actual [-1 ].' Calories ' | Should - Be 16
67
- $actual [-1 ].' Protein (g) ' | Should - Be 0
68
- $actual [-1 ].' Carbs (g) ' | Should - Be 3
66
+ $actual [-1 ].' Vegetable' | Should - Be ' Celery'
67
+ $actual [-1 ].' Calories' | Should - Be 16
68
+ $actual [-1 ].' Protein (g)' | Should - Be 0
69
+ $actual [-1 ].' Carbs (g)' | Should - Be 3
69
70
$actual [-1 ].' Fat (g)' | Should - Be 0
70
71
}
71
72
@@ -88,17 +89,17 @@ Celery | 16 | 0 | 3 | 0
88
89
$names = $actual [0 ].psobject.Properties.Name
89
90
90
91
$names.Count | Should - Be 3
91
- $names [0 ] | Should - Be ' President '
92
- $names [1 ] | Should - Be ' Term '
93
- $names [2 ] | Should - Be ' Vice President '
92
+ $names [0 ] | Should - Be ' President'
93
+ $names [1 ] | Should - Be ' Term'
94
+ $names [2 ] | Should - Be ' Vice President'
94
95
95
- $actual [0 ].' President ' | Should - Be ' George Washington '
96
- $actual [0 ].' Term ' | Should - Be ' 1789-1797 '
97
- $actual [0 ].' Vice President ' | Should - Be ' John Adams '
96
+ $actual [0 ].' President' | Should - Be ' George Washington'
97
+ $actual [0 ].' Term' | Should - Be ' 1789-1797'
98
+ $actual [0 ].' Vice President' | Should - Be ' John Adams'
98
99
99
- $actual [-1 ].' President ' | Should - Be ' James Monroe '
100
- $actual [-1 ].' Term ' | Should - Be ' 1817-1825 '
101
- $actual [-1 ].' Vice President ' | Should - Be ' Daniel D. Tompkins '
100
+ $actual [-1 ].' President' | Should - Be ' James Monroe'
101
+ $actual [-1 ].' Term' | Should - Be ' 1817-1825'
102
+ $actual [-1 ].' Vice President' | Should - Be ' Daniel D. Tompkins'
102
103
}
103
104
104
105
It " ConvertFrom-GPTMarkdownTable - with whitespace" {
@@ -118,16 +119,16 @@ Celery | 16 | 0 | 3 | 0
118
119
119
120
$names = $actual [0 ].psobject.Properties.Name
120
121
$names.Count | Should - Be 3
121
- $names [0 ] | Should - Be ' Column 1 '
122
- $names [1 ] | Should - Be ' Column 2 '
123
- $names [2 ] | Should - Be ' Column 3 '
122
+ $names [0 ] | Should - Be ' Column 1'
123
+ $names [1 ] | Should - Be ' Column 2'
124
+ $names [2 ] | Should - Be ' Column 3'
124
125
125
- $actual [0 ].' Column 1 ' | Should - Be ' Cell 1 '
126
- $actual [0 ].' Column 2 ' | Should - Be ' Cell 2 '
127
- $actual [0 ].' Column 3 ' | Should - Be ' Cell 3 '
126
+ $actual [0 ].' Column 1' | Should - Be ' Cell 1 '
127
+ $actual [0 ].' Column 2' | Should - Be ' Cell 2 '
128
+ $actual [0 ].' Column 3' | Should - Be ' Cell 3 '
128
129
129
- $actual [-1 ].' Column 1 ' | Should - Be ' Cell 7 '
130
- $actual [-1 ].' Column 2 ' | Should - Be ' Cell 8 '
131
- $actual [-1 ].' Column 3 ' | Should - Be ' Cell 9 '
130
+ $actual [-1 ].' Column 1' | Should - Be ' Cell 7 '
131
+ $actual [-1 ].' Column 2' | Should - Be ' Cell 8 '
132
+ $actual [-1 ].' Column 3' | Should - Be ' Cell 9 '
132
133
}
133
134
}
0 commit comments