Rspec failing to test a hash - arrays

I'm trying to create a simple menu list and although the program is working, the test is failing. Does anyone know how I can solve the problem? I'm currently getting failings which says: enter image description here
This is my rspec test:
enter image description here
And this is the code to pass the test:
enter image description here

You're simply missing a £ in your test.

Related

Vscode is changing the code I wrote after saving the file, why?

[enter image description here](https://i.stack.imgur.com/lON9e.png)
I'm writing code for a task in a react course and after the file is saved it simply changes what I wrote and a bunch of errors appear and o I don't know why. The first pic is what I wrote, and the second one what happened after I saved the file. Can someone tell me why this is happening?
This never happened to any other code I wrote before.
Your VS Code settings are probably set to run a linter (ESLint maybe?) when you save your file. You can check your settings in the VS Code workspace settings: https://code.visualstudio.com/docs/getstarted/settings. If you hover over the red squiggly lines it will hint at the errors in your code.
It's been awhile since I've worked in React, but I think you might need to wrap your return in a string literal (backticks: ``). You also might want to use Typescript or JSX with React.
You can also post a sample on Stackblitz https://stackblitz.com/ if you want more help.

I found something strange with Autocomplete as search functionality isn't working as expected (Or maybe I'm wrong)

I've implemented a basic search functionality using freeSolo material-ui, but I have a trouble when my array has two same titles. When I attempt to type 'a' I strangely get Woolies as one of the option. When you click elsewhere within the application and click on search box again, I get the correct output.
Confused how can I get rid of this bug.
Screenshot 1
Screenshot 2
REPO URL: https://stackblitz.com/edit/react-ovvfuz?file=demo.tsx
Any help would be greatly appreciated :)

Jest/Enzyme testing: expect.toContain(img)

I want to write a test using Jest/Enzyme that tests whether the correct image is returned depending on a condition. I currently have it passing with expect(wrapper.html()).toContain('<img class="card-img CardImage" src="something.png" alt="Icon"/>');
but I was wondering if there was any way I could just test have it return that it contains an image with className=CardImage?
For example, it would be something along the lines of expect(wrapper.html().img.className).toContain('CardImage'). I've been searching online but can't seem to find a solution.
Yes you can use the method hasClass.
I suggest you to add an id, it will be easier to locate the image.
Here is an example:
expect(wrapper.find('my-image-id').hasClass('CardImage')).to.equal(true);

How to save codes on VS Code Mac?

I am using VS Code on a Mac to write ReactJS, however I find that I could not save my code. If I use command and s to save, then the JSX will be a mess, just like shown in the picture:
enter image description here
So how could I solve it? Thank you
I think your code is being saved, but that your code formatting is messing-up your code.
Hit the following combination : Shift+Command+P
This will open a menu on top. Inside that menu type Format Document With..., and select it. It will allow you to format your code with a different auto-format tool. Choose the one that is appropriate for your code i.e. Prettier.

Face detection code doesnt work

I am currently trying to find the face in a particular image.I am following
this website :
http://www.cognotics.com/opencv/servo_2007_series/part_2/index.html.
I am following the code in this page.But i dont seem to see the option/part
of the code to include my image[ am i supposed to change the argv[1] part in the code to my own image inorder to read my image]
Can someone guide me?
Or is there any better face detection code available?
Thanks
You are supposed to pass your picture as a command line argument.

Resources