-
Notifications
You must be signed in to change notification settings - Fork 0
/
evenbrackets.spec.js
28 lines (27 loc) · 977 Bytes
/
evenbrackets.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import {evenBrackets} from './evenbrackets';
describe('Even brackets', () => {
test('only open', () => {
expect(evenBrackets("(")).toBe(false);
});
test('only open and close', () => {
expect(evenBrackets("()")).toBe(true);
});
test('open and close in reverse order', () => {
expect(evenBrackets(")(")).toBe(false);
});
test('only open and close with content', () => {
expect(evenBrackets("(content)")).toBe(true);
});
test('multiple even number of brackets', () => {
expect(evenBrackets("([{}])")).toBe(true);
});
test('multiple even number of brackets wrong order', () => {
expect(evenBrackets("([{]})")).toBe(false);
});
test('multiple even number of brackets', () => {
expect(evenBrackets("([{}])()[][({{{}}})]")).toBe(true);
});
test('multiple even number of brackets', () => {
expect(evenBrackets("([{}])()[][({{{}}})]}")).toBe(false);
});
});