From 21f25411dc24e32ab547b60e392b606203c15291 Mon Sep 17 00:00:00 2001 From: Kara Brightwell Date: Thu, 10 Aug 2023 10:01:57 +0100 Subject: [PATCH] test: switch serialiser tests to inline error snapshots (which they effectively were already) --- .../x-interaction/__tests__/serialiser.test.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/components/x-interaction/__tests__/serialiser.test.js b/components/x-interaction/__tests__/serialiser.test.js index ab91780a9..ecd97ad3f 100644 --- a/components/x-interaction/__tests__/serialiser.test.js +++ b/components/x-interaction/__tests__/serialiser.test.js @@ -25,8 +25,8 @@ describe('serialiser', () => { it('throws Error if component is not registered in addData', () => { jest.spyOn(registerComponent, 'getComponent').mockReturnValue(undefined) - expect(() => serialiser.addData('id', Component, {})).toThrow( - `a Serialiser's addData was called for an unregistered component. ensure you're registering your component before attempting to output the hydration data` + expect(() => serialiser.addData('id', Component, {})).toThrowErrorMatchingInlineSnapshot( + `"a Serialiser's addData was called for an unregistered testComponent component with id undefined. ensure you're registering your component before attempting to output the hydration data"` ) }) @@ -34,15 +34,15 @@ describe('serialiser', () => { serialiser.destroyed = true jest.spyOn(registerComponent, 'getComponent').mockReturnValue(Component) - expect(() => serialiser.addData('id', Component, {})).toThrow( - `an interaction component was rendered after flushHydrationData was called. ensure you're outputting the hydration data after rendering every component` + expect(() => serialiser.addData('id', Component, {})).toThrowErrorMatchingInlineSnapshot( + `"a testComponent component was rendered after flushHydrationData was called. ensure you're outputting the hydration data after rendering every component"` ) }) it('throws Error if serialiser is destroyed in flushHydrationData', () => { serialiser.destroyed = true - expect(() => serialiser.flushHydrationData()).toThrow( - `a Serialiser's flushHydrationData was called twice. ensure you're not reusing a Serialiser between requests` + expect(() => serialiser.flushHydrationData()).toThrowErrorMatchingInlineSnapshot( + `"a Serialiser's flushHydrationData was called twice. ensure you're not reusing a Serialiser between requests"` ) })