|
1 |
| -import { describe, beforeEach, it, expect } from 'vitest'; |
| 1 | +import { describe, beforeEach, it, expect, afterAll } from 'vitest'; |
2 | 2 | import { v4 as uuidv4 } from 'uuid';
|
3 | 3 | import { type StixBundle, stixBundleSchema } from '../../src/schemas/sdo/stix-bundle.schema';
|
4 | 4 | import {
|
|
9 | 9 | import type { Collection } from '../../src/schemas/sdo/collection.schema';
|
10 | 10 | import type { Technique } from '../../src/schemas/sdo/technique.schema';
|
11 | 11 | import { z } from 'zod';
|
| 12 | +import { logger } from '../utils/logger'; |
12 | 13 |
|
13 | 14 | /**
|
14 | 15 | * Test suite for validating StixBundle schema.
|
@@ -220,16 +221,21 @@ describe('StixBundleSchema', () => {
|
220 | 221 | });
|
221 | 222 |
|
222 | 223 | bundlesWithErrors.push({ bundleIndex, errors });
|
223 |
| - console.warn(errors.join('\n\n')); |
| 224 | + logger.warn(errors.join('\n\n')); |
224 | 225 | }
|
225 | 226 | }
|
226 | 227 | });
|
227 | 228 |
|
228 | 229 | // Log a summary of the validation results
|
229 |
| - console.log(`Validated ${bundles.length} bundles`); |
230 |
| - console.log(`Found errors in ${bundlesWithErrors.length} bundles`); |
| 230 | + logger.log(`Validated ${bundles.length} bundles`); |
| 231 | + logger.log(`Found errors in ${bundlesWithErrors.length} bundles`); |
231 | 232 |
|
232 | 233 | // This expectation will always pass, but it gives us a way to surface the error count in the test results
|
233 | 234 | expect(bundlesWithErrors.length).toBeLessThanOrEqual(bundles.length);
|
234 | 235 | });
|
| 236 | + |
| 237 | + // Close the logger after all tests are complete |
| 238 | + afterAll(() => { |
| 239 | + logger.close(); |
| 240 | + }); |
235 | 241 | });
|
0 commit comments