forked from NagRock/ts-mockito
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathAnyStringMatcher.spec.ts
56 lines (44 loc) · 1.4 KB
/
AnyStringMatcher.spec.ts
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
import {Matcher} from "../../../src/matcher/type/Matcher";
import {anyString} from "../../../src/ts-mockito";
describe("AnyStringMatcher", () => {
describe("checking if number matches", () => {
it("returns false", () => {
// given
const testObj: Matcher = anyString() as any;
// when
const result = testObj.match(3);
// then
expect(result).toBeFalsy();
});
});
describe("checking if object matches", () => {
it("returns false", () => {
// given
const testObj: Matcher = anyString() as any;
// when
const result = testObj.match({});
// then
expect(result).toBeFalsy();
});
});
describe("checking if empty string matches", () => {
it("returns true", () => {
// given
const testObj: Matcher = anyString() as any;
// when
const result = testObj.match("");
// then
expect(result).toBeTruthy();
});
});
describe("checking if sample string matches", () => {
it("returns true", () => {
// given
const testObj: Matcher = anyString() as any;
// when
const result = testObj.match("sampleString");
// then
expect(result).toBeTruthy();
});
});
});