How to use the @sinonjs/referee.add function in @sinonjs/referee

To help you get started, we’ve selected a few @sinonjs/referee examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sinonjs / sinon / test / test-helper.js View on Github external
"use strict";

var referee = require("@sinonjs/referee");

referee.add("spy", {
    assert: function(obj) {
        return obj !== null && typeof obj.calledWith === "function" && !obj.returns;
    },
    assertMessage: "Expected object ${0} to be a spy function",
    refuteMessage: "Expected object ${0} not to be a spy function"
});

referee.add("stub", {
    assert: function(obj) {
        return obj !== null && typeof obj.calledWith === "function" && typeof obj.returns === "function";
    },
    assertMessage: "Expected object ${0} to be a stub function",
    refuteMessage: "Expected object ${0} not to be a stub function"
});

referee.add("mock", {
    assert: function(obj) {
        return obj !== null && typeof obj.verify === "function" && typeof obj.expects === "function";
    },
    assertMessage: "Expected object ${0} to be a mock",
    refuteMessage: "Expected object ${0} not to be a mock"
});

referee.add("fakeServer", {
github sinonjs / sinon / test / test-helper.js View on Github external
assert: function(obj) {
        return obj !== null && typeof obj.calledWith === "function" && !obj.returns;
    },
    assertMessage: "Expected object ${0} to be a spy function",
    refuteMessage: "Expected object ${0} not to be a spy function"
});

referee.add("stub", {
    assert: function(obj) {
        return obj !== null && typeof obj.calledWith === "function" && typeof obj.returns === "function";
    },
    assertMessage: "Expected object ${0} to be a stub function",
    refuteMessage: "Expected object ${0} not to be a stub function"
});

referee.add("mock", {
    assert: function(obj) {
        return obj !== null && typeof obj.verify === "function" && typeof obj.expects === "function";
    },
    assertMessage: "Expected object ${0} to be a mock",
    refuteMessage: "Expected object ${0} not to be a mock"
});

referee.add("fakeServer", {
    assert: function(obj) {
        return (
            obj !== null &&
            Object.prototype.toString.call(obj.requests) === "[object Array]" &&
            typeof obj.respondWith === "function"
        );
    },
    assertMessage: "Expected object ${0} to be a fake server",
github sinonjs / sinon / test / test-helper.js View on Github external
refuteMessage: "Expected object ${0} not to be a mock"
});

referee.add("fakeServer", {
    assert: function(obj) {
        return (
            obj !== null &&
            Object.prototype.toString.call(obj.requests) === "[object Array]" &&
            typeof obj.respondWith === "function"
        );
    },
    assertMessage: "Expected object ${0} to be a fake server",
    refuteMessage: "Expected object ${0} not to be a fake server"
});

referee.add("clock", {
    assert: function(obj) {
        return obj !== null && typeof obj.tick === "function" && typeof obj.setTimeout === "function";
    },
    assertMessage: "Expected object ${0} to be a clock",
    refuteMessage: "Expected object ${0} not to be a clock"
});
github sinonjs / sinon / test / test-helper.js View on Github external
"use strict";

var referee = require("@sinonjs/referee");

referee.add("spy", {
    assert: function(obj) {
        return obj !== null && typeof obj.calledWith === "function" && !obj.returns;
    },
    assertMessage: "Expected object ${0} to be a spy function",
    refuteMessage: "Expected object ${0} not to be a spy function"
});

referee.add("stub", {
    assert: function(obj) {
        return obj !== null && typeof obj.calledWith === "function" && typeof obj.returns === "function";
    },
    assertMessage: "Expected object ${0} to be a stub function",
    refuteMessage: "Expected object ${0} not to be a stub function"
});

referee.add("mock", {
github sinonjs / sinon / test / test-helper.js View on Github external
assert: function(obj) {
        return obj !== null && typeof obj.calledWith === "function" && typeof obj.returns === "function";
    },
    assertMessage: "Expected object ${0} to be a stub function",
    refuteMessage: "Expected object ${0} not to be a stub function"
});

referee.add("mock", {
    assert: function(obj) {
        return obj !== null && typeof obj.verify === "function" && typeof obj.expects === "function";
    },
    assertMessage: "Expected object ${0} to be a mock",
    refuteMessage: "Expected object ${0} not to be a mock"
});

referee.add("fakeServer", {
    assert: function(obj) {
        return (
            obj !== null &&
            Object.prototype.toString.call(obj.requests) === "[object Array]" &&
            typeof obj.respondWith === "function"
        );
    },
    assertMessage: "Expected object ${0} to be a fake server",
    refuteMessage: "Expected object ${0} not to be a fake server"
});

referee.add("clock", {
    assert: function(obj) {
        return obj !== null && typeof obj.tick === "function" && typeof obj.setTimeout === "function";
    },
    assertMessage: "Expected object ${0} to be a clock",

@sinonjs/referee

Assertions for any JavaScript test framework and environment

BSD-3-Clause
Latest version published 3 months ago

Package Health Score

76 / 100
Full package analysis

Similar packages