1 00:00:00,500 --> 00:00:03,320 Okay, let's run our tests again, npm test. 2 00:00:04,670 --> 00:00:10,060 And let's implement these three pending tests, that they should multiply 3 00:00:10,060 --> 00:00:14,140 positive numbers, positive and negative numbers, and negative numbers together. 4 00:00:15,500 --> 00:00:19,874 Let's head over to the test_calculator_multiplication. 5 00:00:21,890 --> 00:00:25,955 And we should be able to just import the multiply function. 6 00:00:35,253 --> 00:00:38,164 And we should be able to just assert.equal. 7 00:00:38,164 --> 00:00:43,820 Multiply 2 times 3 should be 6. 8 00:00:56,038 --> 00:00:59,591 In that minus 2 times 3 should be minus 6. 9 00:01:06,111 --> 00:01:10,367 And that minus 2 times 10 00:01:10,367 --> 00:01:15,526 minus 3 should be, cool. 11 00:01:15,526 --> 00:01:20,828 So let's just create a branch git branch, 12 00:01:20,828 --> 00:01:24,816 git checkout branch multiply, 13 00:01:27,461 --> 00:01:33,179 And then git add, git commit. 14 00:01:33,179 --> 00:01:39,423 Created tests for multiplication. 15 00:01:41,150 --> 00:01:41,815 Git push. 16 00:01:48,720 --> 00:01:52,819 Or we need to set the upstream to be origin multiply. 17 00:01:55,602 --> 00:01:59,431 And now let's check out our Travis CI tests. 18 00:02:01,604 --> 00:02:06,259 So as you can see here we have this multiply going here, and 19 00:02:06,259 --> 00:02:11,580 you see it's being pushed into this queue here on the left as well. 20 00:02:15,510 --> 00:02:18,060 And there's an error, and why is that? 21 00:02:20,000 --> 00:02:23,710 Well, multiply is not a function, we've actually wrote the tests but 22 00:02:23,710 --> 00:02:24,890 we didn't implement it. 23 00:02:24,890 --> 00:02:26,790 So let's quickly implement that now. 24 00:02:29,170 --> 00:02:34,933 So, in our index.js we can create a function, multiply, 25 00:02:41,961 --> 00:02:43,500 And then return a times b. 26 00:02:45,840 --> 00:02:53,060 And let's not forget to export it and just to be sure let's do an npm test. 27 00:02:54,560 --> 00:02:57,280 All the tests are passing locally so that's great. 28 00:02:57,280 --> 00:03:02,011 So we can do git add, git commit -m "Added 29 00:03:02,011 --> 00:03:07,014 implementation" and then we can push that. 30 00:03:10,673 --> 00:03:12,500 And it's getting pushed up to the multiply branch. 31 00:03:14,380 --> 00:03:19,298 And then we should start seeing the test being run again. 32 00:03:29,785 --> 00:03:31,710 And as you can see, it passed this time. 33 00:03:31,710 --> 00:03:37,950 Great, so now I want to show you what it looks like when we create a pull request. 34 00:03:37,950 --> 00:03:44,190 So here's our multiply branch and we can click compare and create pull request. 35 00:03:44,190 --> 00:03:49,270 Make sure you select the master branch of your repository and then add a comment, 36 00:03:50,340 --> 00:03:54,230 implemented multiplication. 37 00:03:57,260 --> 00:03:58,220 Create pull request. 38 00:04:03,714 --> 00:04:08,550 And you should see Travis CI now taking a look at the pull request. 39 00:04:09,790 --> 00:04:12,300 And when we click on Pull Requests over here. 40 00:04:12,300 --> 00:04:14,890 And as you can see it's one of the tests again. 41 00:04:14,890 --> 00:04:18,690 So when we click in you can see it's creating the Build system. 42 00:04:35,024 --> 00:04:38,925 Cleaning the repository, installing node. 43 00:04:38,925 --> 00:04:44,050 Running the tests and 44 00:04:44,050 --> 00:04:47,830 it passes. 45 00:04:47,830 --> 00:04:50,560 So let's go back to our pull request and 46 00:04:50,560 --> 00:04:53,500 you can see that all the checks have been passed. 47 00:04:53,500 --> 00:04:57,840 So right now if you're happy you can match that into your master branch. 48 00:04:59,100 --> 00:05:04,799 I hope you've enjoyed this workshop, integrating Travis CI with Node.js.