How can I Import Match into a unit test with Jasmine?

How can I test this helper using unit tests in Velocity/Jasmine? I don’t see a way to import just the Match part from Core. The Match functions just return undefined.

I could stub them but that seems rather silly in this case. Should I just run it in integration instead.

Schema.Comment = {
  createdAt: Date,
  userId: String,
  message: Match.Where(function (msg) {
    check(msg, String);
    return msg.length <= 300;
  })
};    
describe("Post Schema", function() {
  it("should have the correct types", function() {
    Match.test("Example", Schema.Post.message)
    expect(schema.message).toEqual(String);
  });
});       

Yeah, just run it in the server integration mode. You can write unit tests in the server integration mode too. You just need to stub you dependencies with spyOn if required.

1 Like

Thanks @Sanjo , much appreciated!