From 446cd05632eda24e23a209410fb526f30a51b975 Mon Sep 17 00:00:00 2001
From: Yoan VALLET <ext.sopra.yvallet@grandlyon.com>
Date: Tue, 17 Nov 2020 11:48:30 +0100
Subject: [PATCH] feat: test for Navbar component

---
 src/components/Navbar/Navbar.spec.tsx         | 23 ++++++++++++++++
 .../Navbar/__snapshots__/Navbar.spec.tsx.snap | 26 +++++++++++++++++++
 2 files changed, 49 insertions(+)
 create mode 100644 src/components/Navbar/Navbar.spec.tsx
 create mode 100644 src/components/Navbar/__snapshots__/Navbar.spec.tsx.snap

diff --git a/src/components/Navbar/Navbar.spec.tsx b/src/components/Navbar/Navbar.spec.tsx
new file mode 100644
index 000000000..c206738ee
--- /dev/null
+++ b/src/components/Navbar/Navbar.spec.tsx
@@ -0,0 +1,23 @@
+'use strict'
+/* eslint-env jest */
+import React from 'react'
+import { shallow } from 'enzyme'
+import { RecoilRoot } from 'recoil'
+import Navbar from 'components/Navbar/Navbar'
+
+jest.mock('cozy-ui/transpiled/react/I18n', () => ({
+  useI18n: jest.fn().mockResolvedValue({
+    t: (str: string) => str,
+  }),
+}))
+
+describe('Navbar component', () => {
+  it('should be rendered correctly', () => {
+    const component = shallow(
+      <RecoilRoot>
+        <Navbar />
+      </RecoilRoot>
+    ).getElement()
+    expect(component).toMatchSnapshot()
+  })
+})
diff --git a/src/components/Navbar/__snapshots__/Navbar.spec.tsx.snap b/src/components/Navbar/__snapshots__/Navbar.spec.tsx.snap
new file mode 100644
index 000000000..8f4b6a8ea
--- /dev/null
+++ b/src/components/Navbar/__snapshots__/Navbar.spec.tsx.snap
@@ -0,0 +1,26 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`Navbar component should be rendered correctly 1`] = `
+<Context.Provider
+  value={
+    Object {
+      "current": Object {
+        "addTransactionMetadata": [Function],
+        "getGraph": [Function],
+        "getState": [Function],
+        "replaceState": [Function],
+        "subscribeToTransactions": [Function],
+      },
+    }
+  }
+>
+  <Context.Provider
+    value={null}
+  >
+    <Batcher
+      setNotifyBatcherOfChange={[Function]}
+    />
+    <Navbar />
+  </Context.Provider>
+</Context.Provider>
+`;
-- 
GitLab