I have a hard time understanding how dbt unit testing works and I thought I would post here. Sorry if I’m asking something trivial. I wanted to understand the difference between mock_source and mock_ref. (Also, sorry if I’m asking something trivial, this is my first time working with dbt.)
Basically my understanding is that if I pass the csv_input to mock_source() in the unit test for my model (that uses that source) that will be the input for my model? So for example, if I have a model M that uses source S, transforms its columns (C1) and returns new columns (C2). And I want to check if the values were transformed correctly, so I’m writing the unit test for my model. I want to mock the input/give some C1 values. My initial instinct was to use mock_ref() but then I got the error about mismatched rows. (I guess since the source has a lot of rows then what I provided (in this case just 1), this caused the error?). I tried using mock_source too but ran into the same issue.
So I’m wondering how does mock_source/mock_ref work? What’s the mechanism before each other? Maybe anyone could direct me to some documentation that will be useful for me to understand what’s happening better?
Thanks a lot in advance!