瀏覽代碼

Add tests for goober setup

Include goober setup methods in tests.
master
TheoryOfNekomata 1 年之前
父節點
當前提交
478f3b7cc4
共有 2 個文件被更改,包括 31 次插入4 次删除
  1. +30
    -3
      src/index.test.ts
  2. +1
    -1
      tsconfig.json

+ 30
- 3
src/index.test.ts 查看文件

@@ -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 查看文件

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


Loading…
取消
儲存