-
-
Notifications
You must be signed in to change notification settings - Fork 80
/
Copy pathis-unique.test.js
61 lines (50 loc) · 1.52 KB
/
is-unique.test.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import { describe, expect, it } from 'vitest';
import {
isUnique,
isUniqueNSquare,
isUniqueWithSet,
isUniqueWithSetSimplified,
isUniqueWithoutDS,
} from './is-unique';
const unique = 'asdfghjkl';
const nonUnique = 'asdfghjkla';
describe('isUnique', () => {
it('returns correct result', () => {
expect(isUnique(unique)).toBeTruthy();
});
it('returns false for non-unique characters', () => {
expect(isUnique(nonUnique)).toBeFalsy();
});
});
describe('isUniqueWithSet', () => {
it('returns true for unique characters', () => {
expect(isUniqueWithSet(unique)).toBeTruthy();
});
it('returns false for non-unique characters', () => {
expect(isUniqueWithSet(nonUnique)).toBeFalsy();
});
});
describe('isUniqueWithSetSimplified', () => {
it('returns true for unique characters', () => {
expect(isUniqueWithSetSimplified(unique)).toBeTruthy();
});
it('returns false for non-unique characters', () => {
expect(isUniqueWithSetSimplified(nonUnique)).toBeFalsy();
});
});
describe('isUniqueNSquare', () => {
it('returns true for unique characters', () => {
expect(isUniqueNSquare(unique)).toBeTruthy();
});
it('returns false for non-unique characters', () => {
expect(isUniqueNSquare(nonUnique)).toBeFalsy();
});
});
describe('isUniqueWithoutDS', () => {
it('returns true for unique characters', () => {
expect(isUniqueWithoutDS(unique)).toBeTruthy();
});
it('returns false for non-unique characters', () => {
expect(isUniqueWithoutDS(nonUnique)).toBeFalsy();
});
});