From ac5802ce98f52ea7aae8bb559ec170dfb5b5970f Mon Sep 17 00:00:00 2001 From: Andrey Sitnik Date: Tue, 29 Dec 2020 14:35:30 -0500 Subject: [PATCH] Clean up tests --- test/at-rule.test.ts | 4 +++- test/lazy-result.test.ts | 4 +++- test/map.test.ts | 4 +++- test/node.test.ts | 2 +- test/postcss.test.ts | 4 +++- test/processor.test.ts | 8 ++++++-- 6 files changed, 19 insertions(+), 7 deletions(-) diff --git a/test/at-rule.test.ts b/test/at-rule.test.ts index dfebf5d93..8d77d989b 100644 --- a/test/at-rule.test.ts +++ b/test/at-rule.test.ts @@ -11,7 +11,9 @@ it('initializes with properties', () => { it('does not fall on childless at-rule', () => { let rule = new AtRule() - expect(rule.each(i => i)).not.toBeDefined() + rule.each(() => { + throw new Error('AtRule has no children') + }) }) it('creates nodes property on prepend()', () => { diff --git a/test/lazy-result.test.ts b/test/lazy-result.test.ts index 20ad20b0c..50af1de9f 100644 --- a/test/lazy-result.test.ts +++ b/test/lazy-result.test.ts @@ -55,7 +55,9 @@ it('executes on finally callback', () => { let mockCallback = jest.fn() return new LazyResult(processor, 'a {}', {}) .finally(mockCallback) - .then(() => expect(mockCallback).toHaveBeenCalledTimes(1)) + .then(() => { + expect(mockCallback).toHaveBeenCalledTimes(1) + }) }) it('prints its object type', () => { diff --git a/test/map.test.ts b/test/map.test.ts index 211862426..695774164 100644 --- a/test/map.test.ts +++ b/test/map.test.ts @@ -18,7 +18,9 @@ function read (result: { css: string }): any { let dir = join(__dirname, 'map-fixtures') let doubler = postcss((css: Root) => { - css.walkDecls(decl => decl.parent?.prepend(decl.clone())) + css.walkDecls(decl => { + decl.parent?.prepend(decl.clone()) + }) }) let lighter = postcss((css: Root) => { css.walkDecls(decl => { diff --git a/test/node.test.ts b/test/node.test.ts index de68903df..fd1395d69 100644 --- a/test/node.test.ts +++ b/test/node.test.ts @@ -14,7 +14,7 @@ import postcss, { function stringify (node: AnyNode, builder: (str: string) => void) { if (node.type === 'rule') { - return builder(node.selector) + builder(node.selector) } } diff --git a/test/postcss.test.ts b/test/postcss.test.ts index c64e5a694..5971d2ca1 100644 --- a/test/postcss.test.ts +++ b/test/postcss.test.ts @@ -45,7 +45,9 @@ it('creates plugin', () => { jest.spyOn(console, 'warn').mockImplementation(() => true) let plugin = (postcss as any).plugin('test', (filter?: string) => { return (root: Root) => { - root.walkDecls(filter ?? 'two', i => i.remove()) + root.walkDecls(filter ?? 'two', i => { + i.remove() + }) } }) expect(console.warn).toHaveBeenCalledTimes(1) diff --git a/test/processor.test.ts b/test/processor.test.ts index 81d35314a..fbd51b22c 100644 --- a/test/processor.test.ts +++ b/test/processor.test.ts @@ -186,7 +186,9 @@ it('calls all plugins once', async () => { it('parses, converts and stringifies CSS', () => { expect( typeof new Processor([ - (css: Root) => expect(css instanceof Root).toBe(true) + (css: Root) => { + expect(css instanceof Root).toBe(true) + } ]).process('a {}').css ).toEqual('string') }) @@ -328,7 +330,9 @@ it('throws parse error in async', async () => { it('throws error on sync method to async plugin', () => { let async = () => { - return new Promise(resolve => resolve()) + return new Promise(resolve => { + resolve() + }) } expect(() => { new Processor([async]).process('a{}').css