How to use the @sinonjs/samsam.match function in @sinonjs/samsam

To help you get started, we’ve selected a few @sinonjs/samsam 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 / referee / lib / assertions / exception.js View on Github external
this.actualExceptionStack = err.stack;
            }

            if (!err) {
                if (typeof matcher === "object") {
                    return this.fail(typeNoExceptionMessage);
                }
                return this.fail("message");
            }

            if (typeof matcher === "object" && !samsam.match(err, matcher)) {
                var prop;
                for (prop in matcher) {
                    if (
                        hasOwnProperty(matcher, prop) &&
                        !samsam.match(err[prop], matcher[prop])
                    ) {
                        return this.fail(typeFailMessage);
                    }
                }
                return true;
            }

            if (typeof matcher === "function" && matcher(err) !== true) {
                return this.fail(matchFailMessage);
            }

            return true;
        },
github sinonjs / referee / lib / assertions / exception.js View on Github external
var err = captureException(callback);

            if (err) {
                this.actualExceptionType = err.name;
                this.actualExceptionMessage = err.message;
                this.actualExceptionStack = err.stack;
            }

            if (!err) {
                if (typeof matcher === "object") {
                    return this.fail(typeNoExceptionMessage);
                }
                return this.fail("message");
            }

            if (typeof matcher === "object" && !samsam.match(err, matcher)) {
                var prop;
                for (prop in matcher) {
                    if (
                        hasOwnProperty(matcher, prop) &&
                        !samsam.match(err[prop], matcher[prop])
                    ) {
                        return this.fail(typeFailMessage);
                    }
                }
                return true;
            }

            if (typeof matcher === "function" && matcher(err) !== true) {
                return this.fail(matchFailMessage);
            }
github sinonjs / referee / lib / assertions / match.js View on Github external
assert: function(actual, matcher) {
            return samsam.match(actual, matcher);
        },
        assertMessage:
github sinonjs / referee / lib / assertions / match-json.js View on Github external
assert: function(actual, matcher) {
            var parsed;
            try {
                parsed = JSON.parse(actual);
            } catch (e) {
                return this.fail(parseErrorMessage);
            }

            return samsam.match(parsed, matcher);
        },
        assertMessage:

@sinonjs/samsam

Value identification and comparison functions

BSD-3-Clause
Latest version published 1 year ago

Package Health Score

80 / 100
Full package analysis

Similar packages