Browse Source

Add tests for goober setup

Include goober setup methods in tests.
master
TheoryOfNekomata 11 months ago
parent
commit
478f3b7cc4
2 changed files with 31 additions and 4 deletions
  1. +30
    -3
      src/index.test.ts
  2. +1
    -1
      tsconfig.json

+ 30
- 3
src/index.test.ts View File

@@ -1,18 +1,27 @@
import { css, CssIfStringImpl, CssStringImpl } from '.';
import {
css,
CssIfStringImpl,
CssStringImpl,
setup,
extractCss,
} from '.';
import {
vi,
describe,
it,
expect,
} from 'vitest';
import { setup as setupGoober, extractCss as extractCssGoober } from 'goober';

vi.mock('goober', () => {
return {
css: () => 'gooberClass',
setup: vi.fn(),
extractCss: vi.fn(),
};
});

describe('css-utils', () => {
describe('@tesseract-design/goofy-goober', () => {
describe('css', () => {
it('should return CssString', () => {
const c = css`
@@ -140,4 +149,22 @@ describe('css-utils', () => {
).toBe('class1 class2 gooberClass');
})
})
})

describe('setup', () => {
it('should call setup from goober', () => {
const pragma = vi.fn();
const prefixer = vi.fn();
setup(pragma, prefixer);

expect(setupGoober).toHaveBeenCalledWith(pragma, prefixer);
})
});

describe('extractCss', () => {
it('should call extractCss from goober', () => {
extractCss();

expect(extractCssGoober).toHaveBeenCalled();
})
});
});

+ 1
- 1
tsconfig.json View File

@@ -13,7 +13,7 @@
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"moduleResolution": "node",
"jsx": "react",
"jsx": "react-jsx",
"esModuleInterop": true,
"target": "ES2017"
}


Loading…
Cancel
Save