Angular Unit Testing Course - All That You Need to Know About Testing
Vložit
- čas přidán 11. 06. 2024
- ► CHECK THE FULL ANGULAR UNIT TESTING COURSE - monsterlessons-academy.com/co...
Welcome to my Angular unit testing course. This course covers all knowledge about Angulae unit testing and E2E testing. You will learn testing utilities, services, components and event NgRx. You will learn how to test RxJS, mock Http requests, use spy and mocks and much more. We will also test fully a real project so you'll see how it works in reality. By the end of this course you will be prepared to test any Angular project.
TIMESTAMPS
0:00 Start
0:18 Introduction
1:33 Why testing?
4:05 Source code
4:36 Setting up Node and Angular
8:09 What is unit testing
9:53 Setting up Jest
14:41 Testing utilities
25:31 Basic service testing
34:49 Mock and Spy
46:38 Testing RxJS streams
51:16 Testing HTTP in Angular
01:04:29 Testing HTTP errors
► CHECK MY COURSES - monsterlessons-academy.com/co...
MOST POPULAR COURSES
► Javascript interview questions - monsterlessons-academy.com/co...
► Typescript interview questions - monsterlessons-academy.com/co...
► React interview questions - monsterlessons-academy.com/co...
► Angular Interview Questions monsterlessons-academy.com/co...
► Building real project with Angular + NgRx - monsterlessons-academy.com/co...
► Building real NestJS API - monsterlessons-academy.com/co...
► Building real fullstack project - monsterlessons-academy.com/co...
► Mastering Git - monsterlessons-academy.com/co...
► Mastering Docker and Docker Compose - monsterlessons-academy.com/co...
FOLLOW ME
► TWITTER - / monster_lessons
► INSTAGRAM - / monsterlessonsacademy
► TIKTOK - / monsterlessonsacademy
Awesome! This comes to the right time :) Please keep up the great content.
Thank you so much for your support. It means a lot to me!
This is definitely the BEST course on Angular Testing. I also bought your full course.
Thank you, keep up the good work!
Glad you enjoy it!
Awesome course, thank you
Glad you like it!
As far as I know, you can simply destructure the 'expect' function from the callback parameter object inside 'it', in order to make it work with asynchronous code. Something like this:
it('should expect asynchronously', ({ expect }) => {api.getTags().subscribe((response) => { expect(response).toBeTruthy(); })})
But maybe this is just working with vitest, don't know for sure. Anyways, thanks for the content!
Sure there are multiple variants to do that
thanks
Welcome
For react will be useful also
I will add it to the list of future courses
@@MonsterlessonsAcademy a lot of thanks
Please upload for react too and next js.
I want also for react.
you too comment maybe he will read yours he havent replied to mine comment
Thank you. I will add it in the list of ideas for the next course
thanks a lot sir @@MonsterlessonsAcademy
What is the purpose of mocking the http response and testing that the response is equal to the moked one we provided? Shouldn't it always pass? I can't understand what we are testing there
There is no purpose in that. We test what our function returns. After API call we might do data transformations and we want to know if we get them in the format how we expect.
@@MonsterlessonsAcademy Ok, thank you for the response, i didn't get the logic!
35:00
I followed this video till minute 21 and I am stuck. I have this error when running the test: ({"Object.":function(module,exports,require,__dirname,__filename,jest){import { range } from './utils';
^^^^^^
SyntaxError: Cannot use import statement outside a module
at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1505:14)
Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 0.916 s
Ran all test suites. I can't fix it. can you help me please?
Unfortunately I can't help without debugging your code.
Are you sure you have not nested the import-Statement somewhere? Did you correctly place the import in the beforeEach function? Any syntax errors or anything else like that?
Would this work with Angular 14?
Yes. The only difference is that standalone components are not there yet but it doesn't change anything. You inject a component in the test in another way. This is it.
You're a great presenter. Keep doing what you do!@@MonsterlessonsAcademy
Why does nothing work when i follow setup guides to the T. getting some bullshit error about must use import in testing.mjs...
That is when you learn the most. You don't learn much following these to the T. There is a very good reason that this industry pays well. It is not easy. If it were everyone would do it and very few would make good money. Embrace the struggle 💪🏼
Problem is, I’m dumb as fuck 😂
Just for you to know that in the full course you get source code to each lesson and I help with debugging all your problems across the course.
@lewiemarks6418, we are all pretty dumb. It's really about being patient and persevering. Just keep it up day in day out. After a few years you will look back and see great results. No meaningful achievement ever comes without hard work and sacrifice.
@@mickelsie5461 100% agree. Consistency is a key. Btw even after 13 years of experience the last bug that I had took 3 months to debug. So it takes time -_-
It lacks the link to github with this code...
It's a part of the paid course. You get access to the code under every single video inside a full course
@@MonsterlessonsAcademy Oh, I see. Thank you ☺️
where is the source code?
As this is a part of the full course you get access to the course code of each video inside the course.