|
9 | 9 |
|
10 | 10 | import { assertEquals, assertThrows } from 'jsr:@std/assert'; |
11 | 11 | import { ensureDir, exists } from 'jsr:@std/fs'; |
12 | | -import { GeneratorRoute, SingleRoute, SiteGenerator } from '../index.ts'; |
| 12 | +import { GeneratorRoute, SingleRoute, SiteGenerator, STEVE } from '../index.ts'; |
13 | 13 |
|
14 | 14 | // ~~~~~ SingleRoute testing ~~~~~ |
15 | 15 | Deno.test('SingleRoute: generates a single route with render content', () => { |
@@ -277,10 +277,8 @@ Deno.test('SiteGenerator: handles ignored files correctly', async () => { |
277 | 277 |
|
278 | 278 | // Create SiteGenerator instance |
279 | 279 | const generator = new SiteGenerator({ |
280 | | - staticDirectory: '', |
281 | 280 | outputDirectory: outputDir, |
282 | 281 | ignoredFiles: ['ignore.txt'], |
283 | | - showExtension: false, |
284 | 282 | }); |
285 | 283 |
|
286 | 284 | // Define routes (empty for simplicity) |
@@ -330,3 +328,30 @@ Deno.test('SiteGenerator: throws error when outputDirectory is not provided', () |
330 | 328 | "please provide an 'outputDirectory' for the files to go to!", |
331 | 329 | ); |
332 | 330 | }); |
| 331 | + |
| 332 | +Deno.test('SiteGenerator: check to see if global modules work', async () => { |
| 333 | + const tempDir = await Deno.makeTempDir(); |
| 334 | + const outputDir = `${tempDir}/output`; |
| 335 | + |
| 336 | + // Create SiteGenerator instance |
| 337 | + STEVE.addPlugin( |
| 338 | + new SiteGenerator({ |
| 339 | + outputDirectory: outputDir, |
| 340 | + }), |
| 341 | + ); |
| 342 | + |
| 343 | + // Generate the site |
| 344 | + STEVE.generate({ |
| 345 | + root: new SingleRoute({ |
| 346 | + render: |
| 347 | + '<steve> return steve.joinPaths(...steve.data.paths); </steve>', |
| 348 | + data: { paths: ['hello', 'world'] }, |
| 349 | + }), |
| 350 | + }); |
| 351 | + |
| 352 | + const text = await Deno.readTextFile(`${outputDir}/index.html`); |
| 353 | + assertEquals(text.includes('hello\\world'), true); |
| 354 | + |
| 355 | + // Cleanup |
| 356 | + await Deno.remove(tempDir, { recursive: true }); |
| 357 | +}); |
0 commit comments