From 478f3b7cc49b474934b1992c306e029d4c28e352 Mon Sep 17 00:00:00 2001 From: TheoryOfNekomata Date: Mon, 10 Apr 2023 09:51:39 +0800 Subject: [PATCH] Add tests for goober setup Include goober setup methods in tests. --- src/index.test.ts | 33 ++++++++++++++++++++++++++++++--- tsconfig.json | 2 +- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/src/index.test.ts b/src/index.test.ts index b8778a9..f38fedb 100644 --- a/src/index.test.ts +++ b/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(); + }) + }); +}); diff --git a/tsconfig.json b/tsconfig.json index 4ae90a1..8973956 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,7 +13,7 @@ "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, "moduleResolution": "node", - "jsx": "react", + "jsx": "react-jsx", "esModuleInterop": true, "target": "ES2017" }