UNPKG

@signatu/common-lib

Version:

Common Javascript/Typescript library for Signatu

27 lines 1.29 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var braces_1 = require("./braces"); test('returns true for undefined input', function () { expect(braces_1.matchingBraces(undefined)).toEqual(true); expect(braces_1.matchingBraces(null)).toEqual(true); }); test('throws error for non-string input', function () { expect(function () { return braces_1.matchingBraces({}); }).toThrow('matchingBraces: argument must be a string'); }); test('returns true for balanced braces', function () { expect(braces_1.matchingBraces('{}')).toEqual(true); expect(braces_1.matchingBraces('{{}}')).toEqual(true); expect(braces_1.matchingBraces('()')).toEqual(true); expect(braces_1.matchingBraces('(((foo)bar))')).toEqual(true); }); test('returns false for unbalanced braces', function () { expect(braces_1.matchingBraces('{')).toEqual(false); expect(braces_1.matchingBraces('}')).toEqual(false); expect(braces_1.matchingBraces('{{}}}')).toEqual(false); expect(braces_1.matchingBraces('())')).toEqual(false); }); test('returns false for braces of different type', function () { expect(braces_1.matchingBraces('{)')).toEqual(false); expect(braces_1.matchingBraces('(}')).toEqual(false); }); //# sourceMappingURL=braces.test.js.map