. Those normally are set into the drywall by cutting a hole the size of the cabinet and then screwing filler blocks of 2x4 to the studs so it edges the hole and then put in the cabinet and put the screws into the sides of cabinet into the wood. Then you do not have to think about how strong it is for you could put bricks in there(or dead body parts) or half a dozen bottles of shampoo you got on sale. The screws will hold it.
Or what you can do, though it is usually not planned for.
People paint the wall. And before the wall paint dries they screw on the cabinet such as you have.
(They do this on wooden windows and doors, then shut the doors and windows. Once the paint is dry in about a week, well forget about opening the windows again. The door has to be kicked in to open it. Paint makes an excellent glue. Not that it was planned for but it just turned out that way.)
It's not recommended. If you've already done it, you may as well try it and see if you run into problems, but don't put anything breakable in it, in case it drops off the wall.
The little plastic fittings for drywall are inexpensive, so personally, I'd do it properly. Since a cabinet is designed to hold things, you really have no idea how much weight it may have to carry in the future, even if your current plans are to only put a few things in.
You should have used a stud finder and that way you could screw two horizontal boards to the wall first so then you could apply screws to those boards. They need not be very thick, just good sturdy quarter inch or half inch studs. Also, the idea of screwing directly into wallboard near a fixture suggests a high level of possibly making direct contact with the electrical wire with the screw and this is a definite electrical hazard.
You don't want drywall screws. Those are for attaching drywall to studs. What you want are anchors (aka Rawl Plugs in some places).
I like Wall Drillers. You can get them at any hardware store or home center. You can attach some very heavy things with them. Much better than those plastic plugs many people use.
I have two 50 pound mirrors in our master bath held up by them.
i just put up a small, light cabinet in my bathroom, i'm 96% sure it was just into straight drywall, like not into a beam. i didn't use drywall screws either..... but it's pretty light by itself, and all that's going to be going on there is small light things like lotions and toothpaste and stuff. so like will it be okay?? it seems pretty stable, i kind of pushed down on it with my hand and it stills seems good. help?????