How do you deal with Testing?

One thing I've noticed, especially with these cocky early 20s girls is that, sometimes when it's going really well they'll say something to challenge you, or be contrarian or disagree when it feels like they are doing it for the sake of doing it

Like this one girl i went on a photowalk with, who unprompted told me an objectively great photo I got of a hawk taking flight wasn't really impressive.

or another time when a girl I was joking with about how i used to be boring in school told me " As if you aren't now" but still continued to talk to me and even gave me her name and insta.

When stuff like this happens I feel like they are testing my confidence but I always kind of get caught off guard and don't really know how to respond.

How can I respond in way that's not cocky or defensive but still build attraction?