From ecb7b018c4908f476bd830990ba9ffe8b5065d94 Mon Sep 17 00:00:00 2001 From: Ash Date: Fri, 11 Oct 2024 11:39:01 +0100 Subject: [PATCH] move update in to test --- .../components/latest-levels-auto-refresh.js | 54 +++++++++---------- 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/test/src/js/components/latest-levels-auto-refresh.js b/test/src/js/components/latest-levels-auto-refresh.js index afb30f00b..49f751751 100644 --- a/test/src/js/components/latest-levels-auto-refresh.js +++ b/test/src/js/components/latest-levels-auto-refresh.js @@ -7,33 +7,6 @@ const lab = script() const { describe, it, before, afterEach } = lab exports.lab = lab -const htmlNewUpdate = { - ok: true, - text: () => ` -
-
-

- 15 minutes ago -

-

The River Thames level at London was 0.10 metres. Property flooding is possible when it goes above 4.00 metres.

-

- Monitor the latest level at London -

-
- -
-

- 15 minutes ago -

-

The Sea Cut level at Mowthorpe was 0.20 metres. Property flooding is possible when it goes above 2.00 metres.

-

- Monitor the latest level at Mowthorpe -

-
-
- ` -} - describe('latestLevels', () => { let window let document @@ -97,7 +70,32 @@ describe('latestLevels', () => { }) it('should fetch levels and update the DOM with the new values', () => { - mockFetch.returns(Promise.resolve(htmlNewUpdate)) + mockFetch.returns(Promise.resolve({ + ok: true, + text: () => ` +
+
+

+ 15 minutes ago +

+

The River Thames level at London was 0.10 metres. Property flooding is possible when it goes above 4.00 metres.

+

+ Monitor the latest level at London +

+
+ +
+

+ 15 minutes ago +

+

The Sea Cut level at Mowthorpe was 0.20 metres. Property flooding is possible when it goes above 2.00 metres.

+

+ Monitor the latest level at Mowthorpe +

+
+
+ ` + })) const ll = new window.LatestLevelsAutoRefresh()