• Create Account

### #Actualdmatter

Posted 26 April 2013 - 07:58 PM

The first one is better, I think.

I just view those multiple expectations as a single assertion split into multiple lines for convenience.
Really, you're just testing the value of model as though this pseudo code worked:

expect(model).toEqual(defaultModelValue);

More importantly, unless you're following TDD or are very disciplined, you have to weigh up how likely you are to write a given unit test - the first example is quicker and easier to write and therefore more likely to get written. Unit tests that actually exist, even if they're less than perfect, are better than nothing.

### #2dmatter

Posted 26 April 2013 - 07:57 PM

The first one is better, I think.

I just view those multiple expectations as a single assertion split into multiple lines for convenience.
Really, you're just testing the value of model as though this pseudo code worked:

expect(model).toEqual(defaultModelValue);

More importantly, unless you're following TDD or are very disciplined, you have to weigh up how likely you are to write a given unit test - the first example is quicker and easier to write and therefore more likely to get written. Unit tests that actually exist, even if they're less than perfect, are better than nothing.

### #1dmatter

Posted 26 April 2013 - 07:57 PM

The first one is better, I think.

I just view those multiple expectations as a single assertion split into multiple lines for convenience.
Really, you're just testing the value of
model
, as though this pseudo code worked:

expect(model).toEqual(defaultModelValue);

More importantly, unless you're following TDD or are very disciplined, you have to weigh up how likely you are to write a given unit test - the first example is quicker and easier to write and therefore more likely to get written. Unit tests that actually exist, even if they're less than perfect, are better than nothing.

PARTNERS