https://pulumi.com logo
#general
Title
# general
b

bitter-dentist-28132

09/13/2019, 9:47 PM
i'd like to add some unit tests to my code. i'd like to test multiple properties on multiple objects. is there a way to do that with mocha/jest without having to wrap it all in a promise like
Copy code
return new Promise((resolve, reject) => {
  let num = 0;
  object1.apply(o => {
    expect(o.prop1).toBe(something);
    expect(o.prop2).toBe(somethingElse);
    num++;
    if (num === 2) {
      done();
    }
  });
  object2.apply(o => {
    expect(o.prop1).toBe(something);
    expect(o.prop2).toBe(somethingElse);
    num++;
    if (num === 2) {
      done();
    }
  });
});
i know in QUnit you can do
Copy code
const done = QUnit.done(2);
object1.apply(o => {
  expect(o.prop1).toBe(something);
  expect(o.prop2).toBe(somethingElse);
  done();
});
object2.apply(o => {
  expect(o.prop1).toBe(something);
  expect(o.prop2).toBe(somethingElse);
  done();
});
so i might just end up switching to that, but i'm wondering how you all run these kinds of tests with not-QUnit
h

helpful-bear-175

09/15/2019, 6:47 AM
Like to hear if you switch over to QUnit vs mocha/chai