How can i write test for throwing redwood error

i am throwing in my function like this

if (!independentItems.length) {
      throw new RedwoodError(
        'Invalid dependency (dependencies graph have loop)'

but i can’t write test for it

My understanding of jests expect.toThrow interface is that you can either test the type or the message. but not both at the same time, just like your doing on the next test right after.

yes i think same as you but it didn’t work. please see my console in above picture

i find out finally.
because of sortDependencyTurn is promise.
i write my test like this:

expect(async () => await sortDependencyTurn(array)).rejects.toThrow(