]>
Commit | Line | Data |
---|---|---|
8d2dfbab RBR |
1 | # TOC |
2 | - [test/cologne.js](#testcolognejs) | |
3 | - [test/utilities.js](#testutilitiesjs) | |
4 | - [test/formatters/simple.js](#testformatterssimplejs) | |
5 | - [test/formatters/token.js](#testformatterstokenjs) | |
6 | - [test/loggers/file.js](#testloggersfilejs) | |
7 | - [test/loggers/console.js](#testloggersconsolejs) | |
8 | ||
9 | ||
10 | <a name="testcolognejs"></a> | |
11 | # test/cologne.js | |
12 | #log() should send every argument to the loggers. | |
13 | ||
14 | ||
15 | #log() should send the same arguments to all the loggers. | |
16 | ||
17 | ||
18 | #log() should send all objects in cologne log format. | |
19 | ||
20 | ||
21 | #log() should default to level 6. | |
22 | ||
23 | ||
24 | #debug() should set to level 7. | |
25 | ||
26 | ||
27 | #info() should set to level 6. | |
28 | ||
29 | ||
30 | #notice() should set to level 5. | |
31 | ||
32 | ||
33 | #warn() should set to level 4. | |
34 | ||
35 | ||
36 | #error() should set to level 3. | |
37 | ||
38 | ||
39 | #buildLog() should return a cologne log. | |
40 | ||
41 | ||
42 | #buildLog() should default to level 6. | |
43 | ||
44 | ||
45 | #buildLog() should use the specified level. | |
46 | ||
47 | ||
48 | #buildLog() should use the message property as the message if available. | |
49 | ||
50 | ||
51 | #buildLog() should extend the object with its properties. | |
52 | ||
53 | ||
54 | #log() calls using a pre-built cologne log should maintain the log level. | |
55 | ||
56 | ||
57 | #removeLogger() should do nothing if it can't find a logger. | |
58 | ||
59 | ||
60 | #removeLogger() should remove a logger. | |
61 | ||
62 | ||
63 | #removeLogger() should no longer affect removed logs. | |
64 | ||
65 | ||
66 | #addLogger() should add loggers after instance is live. | |
67 | ||
68 | ||
69 | ||
70 | ok - test/cologne.js | |
71 | <a name="testutilitiesjs"></a> | |
72 | # test/utilities.js | |
73 | ::now() should give a precise bigint timestamp. | |
74 | ||
75 | ||
76 | ::stringify() should behave like JSON.stringify for non-circular objects. | |
77 | ||
78 | ||
79 | ::stringify() should replace circular references with a string. | |
80 | ||
81 | ||
82 | ::stringify() should convert bigint to string. | |
83 | ||
84 | ||
85 | ::getAnsiCode is sending the correct reset code. | |
86 | ||
87 | ||
88 | ::getAnsiCode() should give us a reset code if something weird is sent. | |
89 | ||
90 | ||
91 | ::getAnsiCode() should not have duplicated non-reset codes. | |
92 | ||
93 | ||
94 | ::getAnsiCode() should not return a reset code in any other supported code. | |
95 | ||
96 | ||
97 | ::gettLevelAnsi is red for emerg. | |
98 | ||
99 | ||
100 | ::gettLevelAnsi is red for alert. | |
101 | ||
102 | ||
103 | ::gettLevelAnsi is red for crit. | |
104 | ||
105 | ||
106 | ::gettLevelAnsi is red for error. | |
107 | ||
108 | ||
109 | ::gettLevelAnsi is yellow for warn. | |
110 | ||
111 | ||
112 | ::gettLevelAnsi is blue for notice. | |
113 | ||
114 | ||
115 | ::gettLevelAnsi is blue for info. | |
116 | ||
117 | ||
118 | ::gettLevelAnsi is green for debug. | |
119 | ||
120 | ||
121 | ::gettLevelAnsi is default for other values. | |
122 | ||
123 | ||
124 | ||
125 | ok - test/utilities.js | |
126 | <a name="testformatterssimplejs"></a> | |
127 | # test/formatters/simple.js | |
128 | #format() should output a string in plain mode. | |
129 | ||
130 | ||
131 | #format() should include the from property in plain mode. | |
132 | ||
133 | ||
134 | #format() should include the timestamp property in iso format in plain mode. | |
135 | ||
136 | ||
137 | #format() should include the level string property in plain mode. | |
138 | ||
139 | ||
140 | #format() should include the message property in plain mode. | |
141 | ||
142 | ||
143 | #format() should output a string in color mode. | |
144 | ||
145 | ||
146 | #format() should include the from property in color mode. | |
147 | ||
148 | ||
149 | #format() should include the timestamp property in iso format in color mode. | |
150 | ||
151 | ||
152 | #format() should include the level string property in color mode. | |
153 | ||
154 | ||
155 | #format() should include the message property in color mode. | |
156 | ||
157 | ||
158 | #format() should colorize the string. | |
159 | ||
160 | ||
161 | #format() should colorize only a bit of the string. | |
162 | ||
163 | ||
164 | ||
165 | ok - test/formatters/simple.js | |
166 | <a name="testformatterstokenjs"></a> | |
167 | # test/formatters/token.js | |
168 | #format() should output a string in default mode. | |
169 | ||
170 | ||
171 | #format() should include the message in default mode. | |
172 | ||
173 | ||
174 | #format() should output a string in custom mode. | |
175 | ||
176 | ||
177 | #format() with custom string should include the specified tokens (check 1). | |
178 | ||
179 | ||
180 | #format() with custom string should include the specified tokens (check 2). | |
181 | ||
182 | ||
183 | #format() with iso date should include the timestamp as an iso date. | |
184 | ||
185 | ||
186 | #format() should not replace tokens that don't match. | |
187 | ||
188 | ||
189 | #format() should output a string in ansi mode. | |
190 | ||
191 | ||
192 | #format() with ansi tokens should colorize the string. | |
193 | ||
194 | ||
195 | #format() with ansi reset should reset the string. | |
196 | ||
197 | ||
198 | #format() with ansi tokens should colorize the string based on level. | |
199 | ||
200 | ||
201 | #format() should output a string in plain date mode. | |
202 | ||
203 | ||
204 | #format() with plain date should include the timestamp as-is. | |
205 | ||
206 | ||
207 | #format() should output a string in custom search mode. | |
208 | ||
209 | ||
210 | #format() with a custom search, should properly match the new tokens. | |
211 | ||
212 | ||
213 | ||
214 | ok - test/formatters/token.js | |
215 | <a name="testloggersfilejs"></a> | |
216 | # test/loggers/file.js | |
217 | raw file. | |
218 | ||
219 | ||
220 | formatted file. | |
221 | ||
222 | ||
223 | it should send all params to the file. | |
224 | ||
225 | ||
226 | it should log the raw json object. | |
227 | ||
228 | ||
229 | it should send all params to the file. | |
230 | ||
231 | ||
232 | it should log the formatted object. | |
233 | ||
234 | ||
235 | ||
236 | ok - test/loggers/file.js | |
237 | <a name="testloggersconsolejs"></a> | |
238 | # test/loggers/console.js | |
239 | It should default to the global console. | |
240 | ||
241 | ||
242 | It should send debug messages to console's #log. | |
243 | ||
244 | ||
245 | It should send info and notice messages to console's #info. | |
246 | ||
247 | ||
248 | It should send warn messages to console's #warn. | |
249 | ||
250 | ||
251 | It should send error messages to console's #error. | |
252 | ||
253 | ||
254 | If available, it should send the objects to the formatter. | |
255 | ||
256 | ||
257 | ||
258 | ok - test/loggers/console.js | |
259 | ----------------|----------|----------|----------|----------|-------------------| | |
260 | File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | | |
261 | ----------------|----------|----------|----------|----------|-------------------| | |
262 | All files | 100 | 100 | 100 | 100 | | | |
263 | lib | 100 | 100 | 100 | 100 | | | |
264 | cologne.js | 100 | 100 | 100 | 100 | | | |
265 | utilities.js | 100 | 100 | 100 | 100 | | | |
266 | lib/formatters | 100 | 100 | 100 | 100 | | | |
267 | simple.js | 100 | 100 | 100 | 100 | | | |
268 | token.js | 100 | 100 | 100 | 100 | | | |
269 | lib/loggers | 100 | 100 | 100 | 100 | | | |
270 | console.js | 100 | 100 | 100 | 100 | | | |
271 | file.js | 100 | 100 | 100 | 100 | | | |
272 | ----------------|----------|----------|----------|----------|-------------------| |