Implementing a login request

Let's assume that a colleague is developing a web service, but it is not finished yet. However, we already know what the API will look like. There will be an endpoint for the login. The URL will be https://awesometodos.com/login; it will take two parameters: a username and password, and it will return a token that has to be used with each further call to the API.

We need a test that asserts that the token that is returned from the login call is put into a token struct.

Add a new iOS | Source | Unit Test Case Class, and call it APIClientTests. Import the main module so that it can be tested (@testable import ToDo), and remove the two template tests.

We will split the login feature into several micro features. As ...

Get Test-Driven iOS Development with Swift 4 - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.