From 2a9ad736c549c1a873970c1fc4d262484daf1792 Mon Sep 17 00:00:00 2001 From: Kalle Ott Date: Tue, 30 Jun 2020 17:20:10 +0200 Subject: [PATCH] test: split client and server side tests --- test/index.test.tsx | 23 ---------------------- test/ssr.test.tsx | 47 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 23 deletions(-) create mode 100644 test/ssr.test.tsx diff --git a/test/index.test.tsx b/test/index.test.tsx index 6f57c76..1e46256 100644 --- a/test/index.test.tsx +++ b/test/index.test.tsx @@ -1,6 +1,3 @@ -/** - * @jest-environment node - */ import React from 'react'; import { render } from '@testing-library/react'; import { @@ -8,10 +5,8 @@ import { SpriteContextProvider, IconsCache, initOnClient, - renderSpriteSheetToString, } from '../src/index'; import { act } from 'react-dom/test-utils'; -import { renderToString } from 'react-dom/server'; const svg1 = ` @@ -63,24 +58,6 @@ test('should fill the cache when an icon is rendered', async () => { }); }); -test('render loaded svgs to a svg sprite sheet string', async () => { - const cache: IconsCache = new Map(); - const renderedString = renderToString( - - - , - ); - - const renderedSpriteSheet = await renderSpriteSheetToString( - renderedString, - cache, - ); - - expect(renderedSpriteSheet).toMatchInlineSnapshot( - `""`, - ); -}); - test('client should be able to initiate the cache from a rendered dom', async () => { const cache: IconsCache = new Map(); document.body.innerHTML = `