Is it impossible to unit test anything inside of an ng-template? No idea.

This is what I get for trying to incorporate TDD in everything. 

There is virtually zero info out there on how to unit test anything inside of an ng-template. Jasmine and Karma just don't seem to see it as existing at all. So even something as simple as checking the innerHTML won't work. It just fails with an undefined error. 

Looking on Stack Overflow, either the answers are super complex and not related to what you're doing at all, or (more commonly) they're ignored altogether. 

This is extremely frustrating. I don't like leaving unfinished tickets at work. Especially when I'll be gone for the summer and someone else will clearly figure it out before I return in September (or, more likely, disregard it altogether). This is because I hate not understanding things. 

I've read pretty much every single Stack Overflow and Reddit thread I could find, and couldn't find any solutions that applied to my situation and actually worked. 

The core of the issue is clearly the fact that ng-template isn't rendered like the rest of an HTML page, so it's not visible with the normal Angular testing framework. 

This is why I really prefer to dive into the theory and inner workings of something before starting to "mess around with it". Messing around without a purpose -- without understanding the underlying concepts first -- makes processes extremely inefficient. I don't fully understand the theory behind how ng-template works, or why the dev who originally coded it decided to use it, so this is why I can't figure it out. It might not even be possible at all, but I doubt it. There should be some sort of solution. But it's one of those that probably has to be precisely tailored to my exact bug. 

But I'm done after this week. Won't be back until September. I'm taking a week off and then I'm starting my internship. 

Not understanding things, and not being able to fix them, drives me insane, so the only way I'm going to leave in peace right now is to add more Angular lessons to my project queue. Then, my mind will be at ease, knowing that the requisite knowledge will eventually be acquired. 

I'll leave a comment on the ticket and then bounce, I guess. 

Another annoying bug: apparently if an alarm goes off on your iPhone while you're listening to Musi with AirPods, stopping the alarm will immediately disconnect your AirPods and play your music OUT LOUD. 

It's a very good thing that I was listening to I Hate This Place and not Behemoth or something. Imagine accidentally blasting Bartzabel in an office lol. 

Comments

Popular posts from this blog

Unleashing my inner Disney Princess ✩₊˚.⋆☾⋆⁺₊✧ at the 2024 Disney Princesses Half Marathon

The 20-something types of Computer Science majors

The Evenstar