Our great sponsors
-
Lets use axios for http calls.
-
// RandomUser.spec.js // lets import these two functions import { setupServer } from "msw/node"; import { rest } from "msw"; it('displays title, first and lastname of loaded user from randomuser.me', async () => { // here we will create a server const server = setupServer( // and this server is going to be processing the GET requests rest.get("https://randomuser.me/api", (req, res, ctx) => { // and here is the response it is returning back return res(ctx.status(200), ctx.json({ results: [ { name: { title: 'Miss', first: 'Jennifer', last: 'Alvarez' } } ] })); }) ); // then.. server.listen(); // so at this step we have a server // after this part we don't need to deal with axios or fetch // in this test function render(); const loadButton = screen.queryByRole('button', { name: 'Load Random User' }); userEvent.click(loadButton); const userInfo = await screen.findByText("Miss Jennifer Alvarez"); expect(userInfo).toBeInTheDocument(); });
-
Appwrite
Appwrite - The Open Source Firebase alternative introduces iOS support . Appwrite is an open source backend server that helps you build native iOS applications much faster with realtime APIs for authentication, databases, files storage, cloud functions and much more!
-
Create react app is creating the project having necessary dependencies for the testing. We are using jest* as the test runner which also has the assertion and mocking functionalities.