2024-01-30 10:17:32 -05:00
|
|
|
import * as assert from 'node:assert/strict';
|
|
|
|
import { before, describe, it } from 'node:test';
|
2023-12-27 12:34:01 -05:00
|
|
|
import { loadFixture } from '../../../astro/test/test-utils.js';
|
|
|
|
|
|
|
|
describe('Basic', () => {
|
|
|
|
let fixture;
|
|
|
|
|
|
|
|
before(async () => {
|
|
|
|
fixture = await loadFixture({
|
|
|
|
root: new URL('./fixtures/basic/', import.meta.url),
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('build', () => {
|
|
|
|
before(async () => {
|
|
|
|
await fixture.build();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('works', async () => {
|
|
|
|
const astroChunkDir = await fixture.readdir('/_astro');
|
|
|
|
|
|
|
|
let css = '';
|
|
|
|
for (const file of astroChunkDir) {
|
|
|
|
if (file.endsWith('.css')) {
|
|
|
|
css += await fixture.readFile(`/_astro/${file}`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-30 10:17:32 -05:00
|
|
|
assert.equal(css.includes('box-sizing:border-box;'), true); // base css
|
|
|
|
assert.equal(css.includes('text-red-500'), true); // class css
|
|
|
|
assert.equal(
|
|
|
|
new RegExp(/\.a\[data-astro-cid-.*?\] \.b\[data-astro-cid-.*?\]/).test(css),
|
|
|
|
true,
|
|
|
|
); // nesting
|
2023-12-27 12:34:01 -05:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|