@imranbarbhuiya/mongoose-fuzzy-searching
Version:
Mongoose fuzzy searching plugin
57 lines (56 loc) • 2.54 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var utils_1 = require("./utils");
describe("replaceSymbols", function () {
it("should return `hello world` when the given string is `hello_world`", function () {
expect((0, utils_1.replaceSymbols)("hello_world", false)).toBe("hello world");
});
it("should return `exampledomaincom` when the given string is `example@domain.com`", function () {
expect((0, utils_1.replaceSymbols)("example@domain.com", true)).toBe("exampledomaincom");
});
it("should return `example@domain.com` when the given string is `example@domain.com`", function () {
expect((0, utils_1.replaceSymbols)("example@domain.com", false)).toBe("example@domain.com");
});
});
describe("isObject", function () {
it("should return false when the parameter is array", function () {
expect((0, utils_1.isObject)([])).toBeFalsy();
});
it("should return false when object is empty", function () {
expect((0, utils_1.isObject)({})).toBeFalsy();
});
it("should return false when object is function", function () {
expect((0, utils_1.isObject)(jest.fn)).toBeFalsy();
});
it("should return true when the parameter is an object", function () {
expect((0, utils_1.isObject)({ name: "Joe" })).toBeTruthy();
});
});
describe("isFunction", function () {
it("should return false when the parameter is array", function () {
expect((0, utils_1.isFunction)([])).toBeFalsy();
});
it("should return false when the parameter is null", function () {
expect((0, utils_1.isFunction)(null)).toBeFalsy();
});
it("should return false when the parameter is object", function () {
expect((0, utils_1.isFunction)({})).toBeFalsy();
});
it("should return true when the parameter is a function", function () {
expect((0, utils_1.isFunction)(jest.fn)).toBeTruthy();
});
});
describe("isString", function () {
it("should return false when the parameter is array", function () {
expect((0, utils_1.isString)([])).toBeFalsy();
});
it("should return false when the parameter is null", function () {
expect((0, utils_1.isString)(null)).toBeFalsy();
});
it("should return false when the parameter is object", function () {
expect((0, utils_1.isString)({})).toBeFalsy();
});
it("should return true when the parameter is a string", function () {
expect((0, utils_1.isString)("test")).toBeTruthy();
});
});