1 00:00:01,930 --> 00:00:05,790 In this video we're going to try to write out a test just to make sure that a user cannot sign up at 2 00:00:05,800 --> 00:00:07,230 the same email twice in a row. 3 00:00:07,580 --> 00:00:10,200 So I'm gonna go back over to my sign up test file. 4 00:00:10,260 --> 00:00:11,630 I'm down at the very bottom. 5 00:00:11,650 --> 00:00:18,220 I'm gonna write out a new block and I'll give it a description like it disallows duplicate emails 6 00:00:21,780 --> 00:00:22,540 than inside of here. 7 00:00:22,560 --> 00:00:26,970 We'll attempt to sign up the same email and password combination twice in a row. 8 00:00:27,060 --> 00:00:33,390 The first request we will expect to give us back a response of 2 0 1 which indicates that the sign up 9 00:00:33,390 --> 00:00:35,580 was successful as we did back up here. 10 00:00:35,580 --> 00:00:37,990 Well then duplicate that request once again. 11 00:00:37,990 --> 00:00:41,190 And on the second request we'll just expect to get back a four hundred. 12 00:00:41,190 --> 00:00:46,260 Because remember if an email is already in use we throw a bad request error which is going to send a 13 00:00:46,340 --> 00:00:55,990 200 or a 400 says code back to the user so inside that new block we'll do it in await request on app. 14 00:00:56,070 --> 00:01:01,820 We'll make a post request to API users sign up. 15 00:01:02,010 --> 00:01:09,020 We will send along an email test at test dot com and a password of password. 16 00:01:09,190 --> 00:01:11,110 And then finally we'll put on an expectation. 17 00:01:11,140 --> 00:01:14,890 So in this case again the first request sign up should be successful. 18 00:01:14,890 --> 00:01:17,720 So we should get back to a 1. 19 00:01:17,760 --> 00:01:25,560 Now we can duplicate that total copy paste it down and then on the second one all we're going to expect 20 00:01:25,750 --> 00:01:29,480 different is a responsive four hundred or a status code of 400. 21 00:01:29,710 --> 00:01:31,530 They'll put in 400 instead. 22 00:01:31,950 --> 00:01:33,090 Let's save that. 23 00:01:33,390 --> 00:01:40,070 Check the terminal where's my test window here this looks good. 24 00:01:40,220 --> 00:01:40,520 All right. 25 00:01:40,520 --> 00:01:42,740 There are a couple of more tests I'd like to put together very quickly. 26 00:01:42,770 --> 00:01:45,530 So quick pass one or two more tests in the next video.