<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ani Chidera on Medium]]></title>
        <description><![CDATA[Stories by Ani Chidera on Medium]]></description>
        <link>https://medium.com/@anichidera?source=rss-6f81c4d29a9a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*yMefLAtVAVTnQdqgxNvT3g.jpeg</url>
            <title>Stories by Ani Chidera on Medium</title>
            <link>https://medium.com/@anichidera?source=rss-6f81c4d29a9a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 19:11:29 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@anichidera/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Letters of Credit: Empowering Global Businesses with Off-Balance Sheet Financing in Trade]]></title>
            <link>https://medium.com/@anichidera/letters-of-credit-empowering-global-businesses-with-off-balance-sheet-financing-in-trade-d26ffc7018c1?source=rss-6f81c4d29a9a------2</link>
            <guid isPermaLink="false">https://medium.com/p/d26ffc7018c1</guid>
            <category><![CDATA[trade-finance]]></category>
            <category><![CDATA[letter-of-credit]]></category>
            <category><![CDATA[africa]]></category>
            <category><![CDATA[fintech]]></category>
            <category><![CDATA[breeze]]></category>
            <dc:creator><![CDATA[Ani Chidera]]></dc:creator>
            <pubDate>Wed, 05 Jul 2023 08:17:14 GMT</pubDate>
            <atom:updated>2023-07-05T08:17:14.169Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Rvq4eLAg4ADQVZXce8suUA.jpeg" /></figure><p>In the fast-paced world of international trade, companies all around the world seek efficient financing options to facilitate transactions. One such instrument that has emerged as a cornerstone of trade finance is the Letter of Credit (LC). This article explores the significance of Letters of Credit as a source of off-balance sheet financing, specifically in offering trade finance services to global businesses.</p><p><strong>Understanding Letters of Credit and Off-Balance Sheet Financing </strong><br>A Letter of Credit is a financial document issued by a bank on behalf of an importer, assuring the exporter that payment will be made once the required documents are presented and compliance with the terms and conditions is established. It acts as a guarantee of payment to the exporter and mitigates the risk for both parties involved in the transaction. It is also one of the oldest trade instruments.</p><p>Off-balance sheet financing refers to financial activities that do not appear on a company’s balance sheet. Instead, these arrangements are structured to keep associated assets and liabilities off the books. Letters of Credit are instrumental in achieving this objective, particularly for companies offering trade finance services.</p><p><strong>Advantages for Global Businesses</strong><br>1. Enhanced Credibility: Offering Letters of Credit can significantly enhance the credibility of businesses in the global marketplace. By providing a guarantee of payment, LCs reduce the perceived risk for international partners, increasing the likelihood of securing trade deals.</p><p>2. Reduced Capital Requirements: As off-balance sheet financing, Letters of Credit allow businesses to facilitate trade transactions without tying up substantial amounts of capital. By leveraging the creditworthiness of the issuing bank, the financial burden of large-scale trade deals can be shifted away from the company’s balance sheet.</p><p>3. Risk Mitigation: Companies can utilize Letters of Credit to mitigate various risks involved in cross-border trade. LCs protect exporters against non-payment or default by ensuring that payment is made upon compliance with agreed-upon terms. This risk transfer mechanism enables businesses to engage in international trade with confidence.</p><p>4. Increased Access to Global Markets: The provision of trade finance services through Letters of Credit allows businesses to tap into global markets that may otherwise be inaccessible due to financial constraints. By offering secure payment guarantees, LCs provide the necessary assurance to international partners, fostering mutually beneficial trade relationships.</p><p>5. Business Expansion and Growth: Off-balance sheet financing through Letters of Credit empowers companies to expand their operations and pursue growth opportunities. By reducing the financial constraints associated with traditional lending or direct capital investment, LCs enable businesses to seize international trade opportunities and diversify their revenue streams.</p><p><strong>Breeze Africa: Your Trade Partner in Letters of Credit</strong><br>Breeze Africa specializes in providing Letters of Credit solutions for businesses engaged in international trade. With our expertise and global network of banking partners, we offer tailored LC services that meet the specific needs of our clients. Whether it’s facilitating Standby Letters of Credit, Bank Guarantees, Domestic Letters of Credit, navigating complex LC procedures, or ensuring compliance with international trade regulations, Breeze Africa is committed to supporting businesses in accessing off-balance sheet financing through Letters of Credit. Trust us to be your reliable trade partner in navigating the world of trade finance and maximizing the benefits of LCs for your business operations.</p><p><strong>Conclusion</strong><br>Leveraging Letters of Credit as a source of off-balance sheet financing empowers global businesses to unlock new opportunities for growth in the international trade arena. By enhancing credibility, reducing capital requirements, mitigating risks, and expanding market access, companies can thrive in the global marketplace and foster prosperous trade relationships. Breeze Africa stands ready to assist businesses in harnessing the power of Letters of Credit, providing tailored solutions that meet their unique trade finance requirements.</p><p>Ready to unlock your trade possibilities? start now for free on <a href="https://www.breeze.africa/">Breeze Africa</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d26ffc7018c1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[User re-authentication in your React app.]]></title>
            <link>https://levelup.gitconnected.com/user-re-authentication-in-your-web-app-b11b98faa1f8?source=rss-6f81c4d29a9a------2</link>
            <guid isPermaLink="false">https://medium.com/p/b11b98faa1f8</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[front-end-development]]></category>
            <dc:creator><![CDATA[Ani Chidera]]></dc:creator>
            <pubDate>Thu, 09 Jun 2022 10:19:06 GMT</pubDate>
            <atom:updated>2022-06-29T15:28:04.824Z</atom:updated>
            <content:encoded><![CDATA[<p>An approach to authenticating your users after a period of idle time.</p><figure><img alt="A login screen" src="https://cdn-images-1.medium.com/max/618/1*77mZX1a8XD-0anpgbYdCdQ.png" /></figure><h3>Intro…</h3><p>One of the ways to beef up your app’s security is to re-authenticate users when necessary. In this guide, we’re going to implement a re-authentication feature on a frontend application using react-idle-timer library to detect when a user has been idle after some time. For this guide, the authentication setup will just be localStorage .</p><p><strong>React-idle-timer </strong>is a javascript library used to detect and monitor user activity on your web application. We’ll be using it for this application, run yarn add react-idle-timer to install on your repo.</p><h3>The App.</h3><p>Our Nextjs app will have 2 pages namely login.js and index.js . login.js will contain the login view and logic while index.js will contain our “dashboard” screen and the re-auth logic.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7c266d2525a761451126c7b071a6ca20/href">https://medium.com/media/7c266d2525a761451126c7b071a6ca20/href</a></iframe><p>In login.js we’ll create a simple login form and a login function that saves a random token to localStorage and redirects to our index.js page.</p><p><em>For this guide, only the form button is truly functional but ensure your form inputs are also functional in your app.</em></p><p>Next up is our index.js page where the re-auth feature is implemented.</p><p>We import useIdleTimer hook from react-idle-timer and call it passing in some properties.</p><pre>const { isIdle } = useIdleTimer({</pre><pre>onIdle,</pre><pre>timeout: 15000</pre><pre>});</pre><p>We’re passing 2 properties;</p><ol><li>onIdle: a function that is called when our user is idle after some time.</li><li>timeout: a period (in milliseconds) of inactivity after which our user is declared idle (onIdle is called). We made timeout 15 seconds for this guide, however in a real app timeout can be 15–30 minutes</li></ol><p>useIdleTimer<em> accepts other properties like onActive, crossTab, startManually, etc. but for the purpose and simplicity of this guide, we’ll stick to just 2 properties.</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/77eeafbb0eabdc66e96fcac81b71a44a/href">https://medium.com/media/77eeafbb0eabdc66e96fcac81b71a44a/href</a></iframe><p>Finally, in our index.js the file we create a modal that becomes visible when a user has been idle and the user enters their password to re-authenticate themselves. If they close the modal or reload the page logout function is called.</p><p>We’ve gone through a simple way to implement re-authentication in your web apps. You should check out the <a href="https://idletimer.dev/">react-idle-timer documentation</a> for more info and use cases.</p><p>Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b11b98faa1f8" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/user-re-authentication-in-your-web-app-b11b98faa1f8">User re-authentication in your React app.</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The difference between get, find, query (React Testing Library).]]></title>
            <link>https://levelup.gitconnected.com/the-difference-between-get-find-query-react-testing-library-bcd996ba3baa?source=rss-6f81c4d29a9a------2</link>
            <guid isPermaLink="false">https://medium.com/p/bcd996ba3baa</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[react-testing-library]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Ani Chidera]]></dc:creator>
            <pubDate>Sat, 01 Jan 2022 14:48:53 GMT</pubDate>
            <atom:updated>2022-01-03T14:28:13.837Z</atom:updated>
            <content:encoded><![CDATA[<p>Choosing a suitable query type while working with React Testing Library.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*Bg_nX5M7EWctOBUJFT1BqQ.jpeg" /></figure><h3>Intro</h3><p>React Testing Library (RTL) gives developers methods to find elements on the component it rendered for testing, these methods are called queries. There are 3 main types of RTL query types namely get, find and query.</p><p>In this guide, we’ll be looking at the differences and tips to note while working with any of these query types.</p><h3>get</h3><ul><li>getBy : returns the matching node, however will throw an error if <strong>multiple</strong> matches or <strong>no</strong> matches are found.</li><li>getAllBy : returns an array of matching nodes if <strong>at least one</strong> match is found and throws an error if <strong>no</strong> match is found.</li></ul><p><strong>Tip</strong> : Use these methods if you expect the element / elements to be present upon query.</p><h3>query</h3><ul><li>queryBy : returns the matching node if one match is found and null if no match is found, however will throw an error if <strong>multiple</strong> matches are found.</li><li>queryAllBy : returns an array of matching nodes if <strong>at least one</strong> match is found and an empty array if <strong>no</strong> match is found.</li></ul><p><strong>Tip</strong> : Use these methods if you are looking to confirm presence of an element / elements.</p><h3>find</h3><ul><li>findBy : returns a promise that returns the matching node, however will throw an error if <strong>multiple</strong> matches or <strong>no</strong> matches are found.</li><li>findAllBy : returns a promise that returns an array of matching nodes if <strong>at least one</strong> match is found and throws an error if <strong>no</strong> match is found.</li></ul><p><strong>Tip</strong> : Use these methods if the element / elements being queried might display asynchronously (for example, if your element is expected to only display after an event is fired consider using find as it retries the query after some time).</p><p>For more information on the queries check out the <a href="https://testing-library.com/docs/queries/about/#types-of-queries">React Testing Library</a> docs. I’ll appreciate feedback :).</p><p>Good luck coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bcd996ba3baa" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/the-difference-between-get-find-query-react-testing-library-bcd996ba3baa">The difference between get, find, query (React Testing Library).</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Write a Simple Test for Your Next.js App]]></title>
            <link>https://javascript.plainenglish.io/how-to-write-a-simple-test-for-your-next-js-app-7e7e83420d7a?source=rss-6f81c4d29a9a------2</link>
            <guid isPermaLink="false">https://medium.com/p/7e7e83420d7a</guid>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[jest]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Ani Chidera]]></dc:creator>
            <pubDate>Mon, 20 Dec 2021 18:30:19 GMT</pubDate>
            <atom:updated>2021-12-22T07:23:48.161Z</atom:updated>
            <content:encoded><![CDATA[<h4>A guide to writing a simple test for a Next.js app.</h4><h3><strong>First things first</strong></h3><p>It’s important for software developers to write tests for their software, especially in production to correctly determine whether or not it works effectively and as intended. We don’t want to assume it works only for it to fail later.</p><figure><img alt="But it works on my machine meme" src="https://cdn-images-1.medium.com/max/500/1*GHgUPqdadA8z6EEVE319Hg.jpeg" /></figure><p>Well, it might “work” but you still need to write tests :)</p><p>In this tutorial, I’ll be taking you through writing a simple set of tests for a form in your <a href="https://nextjs.org/">Next.js</a> application using the <a href="https://jestjs.io/">Jest</a> and <a href="https://testing-library.com/docs/react-testing-library/intro">React Testing Library</a>. Let’s take a brief look at these tools mentioned above and set our project up.</p><h3>Next.js</h3><p>Next.js is an open-source JavaScript framework built by <a href="https://vercel.com/breezeio">Vercel</a> which provides React-based web applications functionalities. It enables functionalities such as server-side rendering, serverless functions, static applications, etc.</p><p>We’ll set up our project by creating a new Next.js app.</p><p>Open your terminal and navigate to where you’d keep repos and type the command below.</p><pre>$ npx create next-app@latest</pre><p>This will take you through some installation prompts after which it’ll create a basic Next.js app in our folder. If you’d prefer a TypeScript setup add a TypeScript flag as displayed below:</p><pre>npx create-next-app@latest --typescript</pre><p>Now that we’ve set up our Next.js app let’s add the testing tools to our app.</p><h3>Jest</h3><p>Jest is a Javascript testing framework built by Christoph Nakazawa and currently being maintained by Facebook. One of Jest’s main advantages is simplicity. It’s relatively easy to set up especially for first-time users.</p><p>Let’s install our Jest dependencies using npm:</p><pre>$ npm install -D jest babel-jest</pre><p>This will install Jest and also Babel Jest which ensure Jest works properly with Next.js.</p><p>Next up we’ll create a .babelrc file and add the configuration displayed below. This will help with configuring Babel Jest we already installed.</p><pre>{  <br> &quot;presets&quot;: [&quot;next/babel&quot;] <br>}</pre><p>This ensures Jest works in our app as expected.</p><p>While Jest enables us easily test javascript apps and code it cannot directly test our Next.js app because it does not have the functionality to render React-based components. We’ll therefore need a tool that can work with Jest to render our Next.js app and then run tests on it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/739/1*CACgabuoMFE_DUrXGAdcjQ.jpeg" /></figure><p>That’s where <strong>React Testing Library</strong> comes in.</p><h3>React Testing Library</h3><p>React Testing Library is an open-source tool that helps test your React.js app by rendering it and exposing the DOM to be queried. This helps you test your React.js app in its intention to be used rather than just the implementation details.</p><p>Let’s install the dependencies to our app.</p><pre>$ npm install -D @testing-library/jest-dom @testing-library/react</pre><p>This will install the React Testing Library and a @testing-library/jest-dom package that’ll work with Jest in testing our app.</p><p>Before we start writing our tests let’s make some changes to the package.json file in our project directory.</p><p>The first change is in the scripts field which tells npm how to run tests on our app.</p><pre>“test”: “jest — watch”</pre><p>This tells npm to run jest in watch mode (monitor our changes and run tests accordingly) when we run the npm test a command. Our scripts field should now look as displayed below.</p><pre>“scripts”: {<br> “dev”: “next dev”,<br> “build”: “next build”,<br> “start”: “next start”,<br> “test”: “jest — watch”<br>},</pre><p>Secondly, we’ll add a new field to our package.json called jest .</p><pre>&quot;jest&quot;: {<br> &quot;testEnvironment&quot;: &quot;jsdom&quot;<br>}</pre><p>This tells Node to use jsdom as our test environment. The default Node testEnvironment won’t enable us to test using a browser environment.</p><p>Having set up these tools we can now proceed to code and write our tests.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*8g1HtXc2IlMAD48S4TZh4w.jpeg" /></figure><p>We’ll start by creating a basic sign-up form and then we’ll write tests for it.</p><h3>Sign up form</h3><p>We’ll navigate to our index.js file, delete all its content, and import useState.</p><pre>import { useState } from &#39;react&#39;;</pre><p>Next up, we create a RegisterPage component and in it, we’ll create a basic form which we’ll be testing.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a3a69154ec8a8cad06fd05fec60ac686/href">https://medium.com/media/a3a69154ec8a8cad06fd05fec60ac686/href</a></iframe><p>In this RegisterPage component we declare an isLoading state value and set it to false. This value will indicate whether our being submitted (isLoading) or not.</p><p>We then proceed to create a registerUser function which we’ll use to simulate a form submission, it’ll prevent the default form submission, set isLoading to true and set it back to false after 5 seconds or 5000 milliseconds.</p><p>Next up we create formInputs, an array of objects, containing form inputs which we’ll render in our return block.</p><p>Moving on, in our component, we’ll create a form, map through our formInputs array, and add a button that calls registerUser when it’s clicked. We can now export our components.</p><h3>Styles</h3><p>Let’s add some basic styling to our styles/globals.css. If you do not have the file create one and import it to your _app.js file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1f7bad07d31683ed4ab2979137a31fda/href">https://medium.com/media/1f7bad07d31683ed4ab2979137a31fda/href</a></iframe><p>We’ll now save these files and run our Next app using npm run dev . When we open our browsers to <a href="http://localhost:3000/">http://localhost:3000</a> we should see our app now up and running.</p><p>Now it’s time to write tests for the form in our app.</p><h3>Testing the app</h3><p>Let’s start by creating a tests folder, in it, we’ll create a subfolder called pages . This is where we’ll be keeping test files for our pages (Create your first test file and name it index.test.js).</p><p>First, we’ll make some imports to our test file.</p><pre>import &#39;@testing-library/jest-dom&#39;;</pre><pre>import { render, screen, fireEvent } from &#39;@testing-library/react&#39;;</pre><p>We import @testing-library/jest-dom which was earlier installed, we also import render, screen and fireEvent from @testing-library/react more on their usage in this tutorial.</p><p>Next up we import the Index file we’ll be testing.</p><pre>import Index from &#39;../../pages/index&#39;;</pre><p>Before we write our tests let us create an array formInputValues that will contain mock data we’ll use in testing our form.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cfd1ee92950532f24590527dcd718a2a/href">https://medium.com/media/cfd1ee92950532f24590527dcd718a2a/href</a></iframe><p>Now, the tests.</p><p>We’ll start by describing what our tests are for. We’ll start by creating a describe block of code. Describe is a Jest method used to group related testing blocks together. It takes two arguments: a string for describing the test suite and a callback function for wrapping the test or tests you’ll be writing.</p><pre>describe(‘Simple working form’, () =&gt; {</pre><pre>});</pre><p>Next up we’ll be writing our test cases in it blocks. it is a Jest method where the actual test functionalities are written. Just like a describe block, it takes 2 arguments: It takes two arguments: a string for describing the test suite and a callback function for wrapping the test functionality. An alternative method to it is test. Let’s start by writing one that tests if all our form inputs were correctly rendered. We’ll do this in our describe block.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/82cd02eecfc0627cea0b9f2e461c4be5/href">https://medium.com/media/82cd02eecfc0627cea0b9f2e461c4be5/href</a></iframe><p>In our it block we’ll pass our Index component to a render method. render is a @testing-library/react method that simulates the render of the React component passed as an argument.</p><p>We then proceed to loop through our formInputValues using forEach . For each value, we call screen.getByLabelText on value.label . screen is a @testing-library/react object that exposes methods used to query our component previously rendered, one of which is getByLabelText . getByLabelText is used to retrieve one element with the label passed as an argument.</p><p>We pass the value returned from screen.getByLabelText as an argument to expect . expect is a Jest method that allows us access to matchers that help us test for certain conditions. An example of a matcher which we use is toBeInTheDocument , calling it on our expect function checks if our argument passed to expect is present in the component we rendered, i.e in the document.</p><p>In essence, we expect elements with labels in our formInputValuesarray to exist in our component.</p><p>Let’s add two more tests to complete our test cases. One that’ll check if our button is present in the document and another that’ll check if our button loads after it’s clicked.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/239b2a4fae2d4999e0ac80d4fbe13300/href">https://medium.com/media/239b2a4fae2d4999e0ac80d4fbe13300/href</a></iframe><p>In our 2nd it block, we render Index, retrieve our button by calling the getByRole method from the screen object and initialize submitButton with the value. getByRole takes several arguments but for this tutorial, we only pass the name of the role we are querying for and an object containing the name of the button (The button’s text). We use two matchers to test for our button. toBeInTheDocument and not.toBeDisabled check if our button is present and not disabled.</p><p><strong>Note</strong>: Using not before any matcher tests for the reverse of the matcher.</p><p>In our 3rd it block, we render Index and retrieve our submitButton . We loop through our inputFormValues array, get the respective inputs, and use fireEvent.change to simulate filling each input with values from our array.</p><p>fireEvent is an object from @testing-library/react with methods used to simulate real dom events. We used change to change the form values and then we use click to simulate a click on our button.</p><p>At last, we check if the value of our button has now been changed to Loading… after the click. We’re able to do that with another query method, findByRole . It is similar to getByRole but it returns a promise that’s resolved after a while.</p><p><strong>Note</strong>: If you expect that your fireEvent changes won’t reflect immediately use findBy, rather than getBy.</p><p>Our index.test.js should now look like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9fed2a77dd6a4b9b64f6e497b0c80af3/href">https://medium.com/media/9fed2a77dd6a4b9b64f6e497b0c80af3/href</a></iframe><p>run npm test a to see your test results, you should see something like this</p><pre>PASS  tests/pages/index.test.js (14.833 s)<br>  Simple working form<br>    √ Should render all form inputs (208 ms)<br>    √ Should render submit button (458 ms)<br>    √ Should submit when inputs are filled and submit button clicked (303 ms)</pre><pre>Test Suites: 1 passed, 1 total<br>Tests:       3 passed, 3 total<br>Snapshots:   0 total<br>Time:        30.426 s<br>Ran all test suites matching /a/i.</pre><h3>Conclusion</h3><p>Congratulations, we’ve successfully tested our Next.js app. Feel free to include more test cases/increase the scope of the tests. The full project is available <a href="https://github.com/chani24/Testing-React-Form">here</a> on my GitHub.</p><p>For more details on the tools used in this tutorial check out the <a href="https://nextjs.org/docs/getting-started">Next.js</a>, <a href="https://jestjs.io/docs/getting-started">Jest</a>, and <a href="https://testing-library.com/docs/react-testing-library/intro">React Testing Library</a> docs.</p><p>I’ll appreciate feedback on this tutorial :), Goodluck coding!</p><p><em>More content at </em><a href="http://plainenglish.io/"><em>plainenglish.io</em></a><em>. Sign up for our </em><a href="http://newsletter.plainenglish.io/"><em>free weekly newsletter here</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e7e83420d7a" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/how-to-write-a-simple-test-for-your-next-js-app-7e7e83420d7a">How to Write a Simple Test for Your Next.js App</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Managing auth state in your Angular Firebase app]]></title>
            <link>https://medium.com/@anichidera/managing-auth-state-in-your-angular-firebase-app-c08d62cf3f43?source=rss-6f81c4d29a9a------2</link>
            <guid isPermaLink="false">https://medium.com/p/c08d62cf3f43</guid>
            <category><![CDATA[firebase]]></category>
            <category><![CDATA[firebaseauthentication]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[rxjs]]></category>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[Ani Chidera]]></dc:creator>
            <pubDate>Wed, 15 Jul 2020 16:32:58 GMT</pubDate>
            <atom:updated>2020-07-15T16:32:58.656Z</atom:updated>
            <content:encoded><![CDATA[<h3>Managing auth state in your Angular Firebase app.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*NnQ1RFFyigISAmsqw5S3XA.jpeg" /></figure><p>Firebase authentication usually comes in handy when building any type of application. It helps manage your app’s users, auth state, as well as track user sessions.</p><p>In this article we’ll go through tracking authentication state in your angular application and emitting changes to other components using Firebase’s onAuthStateChanged Observable and an RXJS Subject.</p><p>let’s dive in……..</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3d3cdcfc5e31ce2562e3faa7eeeab726/href">https://medium.com/media/3d3cdcfc5e31ce2562e3faa7eeeab726/href</a></iframe><p>In the <a href="https://gist.github.com/chani24/1dca2d5d2f315fa0500c1cab0dff289a#file-signin-component-ts">signin.component.ts</a> , we get login data from the form in our template, which we will then pass to our auth service for authentication.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f89bdd4767dc972a9cef9e18a5affbf4/href">https://medium.com/media/f89bdd4767dc972a9cef9e18a5affbf4/href</a></iframe><p>In our <a href="https://gist.github.com/chani24/4b9d75f79d14ec239d91975683573f2a#file-auth-service-ts">auth.service.ts</a>, we import BehaviourSubject and Observable from RXJS. BehavourSubject is a special type of Observable that allows values to be multicast to many Observers. We also import AngularFireAuth from Angular Fire and auth from Firebase/app.</p><p>The following steps explain the process.</p><p>Step 1: Initialize a property, currentUser.</p><p>Step 2 : Initialize a new BehaviourSubject called authStatusSub and pass currentUser as it’s first value.</p><p>Step 3 : Initialize a property, currentAuthStatus which returns authStatusSub as an Obvservable that can be observed across components.</p><p>Step 4 : Create a method called authStatusListener and used onAuthStateChanged to check auth state. If a user is Logged in, we call authStatusSub.next and pass in the current user credentials however if no user is logged in, we pass null into authStatusSub.next.</p><p>authStatusSub.next passes the current value to all Observers. See <a href="https://rxjs-dev.firebaseapp.com/guide/subject">https://rxjs-dev.firebaseapp.com/guide/subject</a> for more explanation.</p><p>Let’s proceed to listen to it’s emissions in another component.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/780a5e4f8266e89aa7c11afeaea4d4c0/href">https://medium.com/media/780a5e4f8266e89aa7c11afeaea4d4c0/href</a></iframe><p>In <a href="https://gist.github.com/chani24/d9f87683c7d1f7e16c077f1c359c7a42#file-header-component-ts">header.component.ts</a>, we subscribe to currentAuthStatus from our auth service and pass it’s value into an earlier initialized isAuthenticated property.</p><p>In <a href="https://gist.github.com/chani24/d9f87683c7d1f7e16c077f1c359c7a42#file-header-component-html">header.component.html</a>, we use conditionals to check if isAuthenticated is truthy or falsy, and then proceed to display elements in accordance.</p><p>We’ve been able to successfully track auth state and emit new changes in our auth status across different components. We’ve also been able to subscribe and get emitted values and use in our application logic.</p><p>Goodluck coding….</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c08d62cf3f43" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>