From 21909fc75e263da4b40cf19ecb757d6fbcdd9430 Mon Sep 17 00:00:00 2001 From: gabrieljablonski Date: Sat, 10 Feb 2024 15:18:04 -0300 Subject: [PATCH] test: css supports is not really testable :( --- src/test/utils.spec.js | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/src/test/utils.spec.js b/src/test/utils.spec.js index 75a1cb11..88cb4847 100644 --- a/src/test/utils.spec.js +++ b/src/test/utils.spec.js @@ -1,4 +1,4 @@ -import { debounce, computeTooltipPosition, cssTimeToMs, cssSupports } from 'utils' +import { debounce, computeTooltipPosition, cssTimeToMs } from 'utils' // Tell Jest to mock all timeout functions jest.useRealTimers() @@ -86,35 +86,6 @@ describe('compute positions', () => { }) }) -describe('css supports', () => { - let windowSpy - - beforeEach(() => { - windowSpy = jest.spyOn(window, 'window', 'get') - }) - - afterEach(() => { - windowSpy.mockRestore() - }) - - test('returns true if css property is supported', () => { - expect(cssSupports('position', 'relative')).toBe(true) - }) - - test('returns false if css property is not supported', () => { - expect(cssSupports('position', 'foo')).toBe(false) - }) - - test('returns true if `window.CSS.supports` is not available', () => { - windowSpy.mockImplementation(() => ({ - CSS: { - supports: undefined, - }, - })) - expect(cssSupports('position', 'foo')).toBe(true) - }) -}) - describe('css time to ms', () => { test('converts time correctly', () => { expect(cssTimeToMs('1s')).toBe(1000)