basic.test.js 932 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import * as assert from 'node:assert/strict';
  2. import { describe, it, before } from 'node:test';
  3. import { loadFixture } from '../../../astro/test/test-utils.js';
  4. describe('Basic', () => {
  5. let fixture;
  6. before(async () => {
  7. fixture = await loadFixture({
  8. root: new URL('./fixtures/basic/', import.meta.url),
  9. });
  10. });
  11. describe('build', () => {
  12. before(async () => {
  13. await fixture.build();
  14. });
  15. it('works', async () => {
  16. const astroChunkDir = await fixture.readdir('/_astro');
  17. let css = '';
  18. for (const file of astroChunkDir) {
  19. if (file.endsWith('.css')) {
  20. css += await fixture.readFile(`/_astro/${file}`);
  21. }
  22. }
  23. assert.equal(css.includes('box-sizing:border-box;'), true); // base css
  24. assert.equal(css.includes('text-red-500'), true); // class css
  25. assert.equal(
  26. new RegExp(/\.a\[data-astro-cid-.*?\] \.b\[data-astro-cid-.*?\]/).test(css),
  27. true
  28. ); // nesting
  29. });
  30. });
  31. });