Skip to content

Commit 529bb79

Browse files
test: update.
1 parent 8281c16 commit 529bb79

9 files changed

Lines changed: 88 additions & 34 deletions

src/test/how-to-executable.spec.ts

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// Object.
2+
import { is } from '@angular-package/type';
3+
// Class.
4+
import { Testing } from '../lib/testing.class';
5+
/**
6+
* Initialize testing.
7+
*/
8+
const t = new Testing(
9+
true, // Disallows executing the `describe()` method globally.
10+
true, // Disallows executing the `it()` method globally.
11+
{
12+
// describe: [1, 2, 3, 5], // Executable unique numbers of `describe()` methods to execute when global executing is disallowed.
13+
// it: [1], // Executable unique numbers of `it()` methods inside the `describe()` to execute when global executing is disallowed.
14+
},
15+
true
16+
);
17+
18+
t.describe('[counter] First describe', () =>
19+
t
20+
.it('[counter] First it() in first describe 1-1', () =>
21+
expect(false).toBeFalse()
22+
)
23+
.it('[counter] Second it() in first describe 1-2', () =>
24+
expect(true).toBeTrue()
25+
)
26+
.it('[counter] Second it() in first describe 1-3', () =>
27+
expect(true).toBeTrue()
28+
)
29+
.it('[counter] Fourth it() in first describe() 1-4', () =>
30+
expect(true).toBeTrue()
31+
)
32+
.describe('[counter] Second describe()', () => {
33+
t.it('[counter] First it() in second describe() 2-1', () =>
34+
expect(true).toBeTrue()
35+
);
36+
})
37+
.describe('[counter] Third describe()', () => {
38+
t.it('[counter] First it() in third describe() 3-1', () =>
39+
expect(true).toBeTrue()
40+
);
41+
})
42+
.describe('[counter] Fourth describe()', () => {
43+
t.it('[counter] First it() in fourth describe() 4-1', () =>
44+
expect(true).toBeTrue()
45+
);
46+
})
47+
);
48+
49+
t.describe('[counter] Fifth describe', () =>
50+
t.it('[counter] First it() in fifth describe 5-1', () =>
51+
expect(false).toBeFalse()
52+
)
53+
);

src/test/how-to-use-actual-method.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
// Constants.
2-
import { Execute } from './execute';
2+
import { ExecuteSpec } from './execute';
33

44
// Class.
55
import { Testing } from '../lib';
66

7-
const execute = true;
7+
const execute = false;
88
const executeDescribe = true;
99
const executeIt = true;
1010

1111
if (execute) {
1212
const t = new Testing(
13-
executeDescribe || Execute.describe['how-to-actual-method'],
14-
executeIt || Execute.it['how-to-actual-method']
13+
executeDescribe || ExecuteSpec.describe['how-to-actual-method'],
14+
executeIt || ExecuteSpec.it['how-to-actual-method']
1515
);
1616

1717
const Calculator = {

src/test/how-to-use-before-each.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
// Constant.
2-
import { Execute } from "./execute";
2+
import { ExecuteSpec } from "./execute";
33

44
// Class.
55
import { Testing } from "../lib";
66

7-
const execute = true;
7+
const execute = false;
88
const executeDescribe = true;
99
const executeIt = true;
1010

1111
if (execute) {
1212
const t = new Testing(
13-
executeDescribe || Execute.describe["how-to-before-each"],
14-
executeIt || Execute.it["how-to-before-each"]
13+
executeDescribe || ExecuteSpec.describe["how-to-before-each"],
14+
executeIt || ExecuteSpec.it["how-to-before-each"]
1515
);
1616

1717
let arr: any[];

src/test/how-to-use-spy-method.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
import { Testing } from '../lib';
33

44
// Constants.
5-
import { Execute } from './execute';
5+
import { ExecuteSpec } from './execute';
66

7-
const execute = true;
7+
const execute = false;
88
const executeDescribe = true;
99
const executeIt = true;
1010

1111
if (execute) {
1212
const t = new Testing(
13-
executeDescribe || Execute.describe['how-to-spy-method'],
14-
executeIt || Execute.it['how-to-spy-method']
13+
executeDescribe || ExecuteSpec.describe['how-to-spy-method'],
14+
executeIt || ExecuteSpec.it['how-to-spy-method']
1515
);
1616
const Calculator = {
1717
currentVal:0,

src/test/random-number.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@ import { randomNumber } from '../lib/function/random-number.func';
33
// Class.
44
import { Testing } from '../lib/testing.class';
55
// Constant.
6-
import { Execute } from './execute';
6+
import { ExecuteSpec } from './execute';
77
/**
88
* Initialize testing.
99
*/
1010

11-
const execute = true;
11+
const execute = false;
1212
const executeDescribe = true;
1313
const executeIt = true;
1414

1515
if (execute ) {
1616
const t = new Testing(
17-
executeDescribe || Execute.describe['random-number'],
18-
executeIt || Execute.it['random-number']
17+
executeDescribe || ExecuteSpec.describe['random-number'],
18+
executeIt || ExecuteSpec.it['random-number']
1919
);
2020
/**
2121
* Execute.

src/test/random-string.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
import { randomString } from '../lib/function/random-string.func';
33
// Class.
44
import { Testing } from '../lib/testing.class';
5-
import { Execute } from './execute';
5+
import { ExecuteSpec } from './execute';
66

77
import { TestingExpectToBe } from '../lib/expectation/testing-expect-to-be.class';
88

9-
const execute = true;
9+
const execute = false;
1010
const executeDescribe = true;
1111
const executeIt = true;
1212

@@ -15,8 +15,8 @@ if (execute) {
1515
* Initialize testing.
1616
*/
1717
const t = new Testing(
18-
executeDescribe || Execute.describe['random-string'],
19-
executeIt || Execute.it['random-string']
18+
executeDescribe || ExecuteSpec.describe['random-string'],
19+
executeIt || ExecuteSpec.it['random-string']
2020
);
2121
// const toBe = new TestingToBeMatchers();
2222
/**

src/test/testing-before-each.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import { Testing } from "../lib";
22

33
import { TestingExpectToBe } from '../lib/expectation/testing-expect-to-be.class';
4-
import { Execute } from "./execute";
4+
import { ExecuteSpec } from "./execute";
55

6-
const execute = true;
6+
const execute = false;
77
const executeDescribe = true;
88
const executeIt = true;
99

1010
if (execute) {
1111
const e = new TestingExpectToBe();
1212
const t = new Testing(
13-
executeDescribe || Execute.describe["testing-before-each"],
14-
executeIt || Execute.it["testing-before-each"]
13+
executeDescribe || ExecuteSpec.describe["testing-before-each"],
14+
executeIt || ExecuteSpec.it["testing-before-each"]
1515
);
1616

1717
let arr: any[];

src/test/testing-custom.spec.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// TestingCustom
2-
import { TestingDescribe, TestingIt } from "../lib";
2+
import { TestingDescribe, TestingExpectation, TestingIt } from "../lib";
33
import { TestingCustom } from "../lib/testing-custom.class";
44

55
// Selected.
@@ -15,9 +15,9 @@ import { TestingToBeString } from "../lib/testing/testing-to-be-string.class";
1515
import { TestingToHave } from "../lib/testing/testing-to-have.class";
1616

1717
// Execute.
18-
import { Execute } from "./execute";
18+
import { ExecuteSpec } from "./execute";
1919

20-
const execute = true;
20+
const execute = false;
2121
const executeDescribe = true;
2222
const executeIt = true;
2323

@@ -30,8 +30,9 @@ if (execute) {
3030
['DescribeA'], // Descriptions for `describe`.
3131
['ItA'], // Expectations for `it`.
3232
[false, false], // `boolean` or list of [`boolean`, `boolean`]
33-
new TestingDescribe(), // Instance for `TestingDescribe` for `counter` purposes
34-
new TestingIt() // Instance for `TestingIt` for `counter` purposes
33+
new TestingDescribe(), // Common instance for `TestingDescribe` for `counter` purposes
34+
new TestingIt(), // Common instance for `TestingIt` for `counter` purposes
35+
new TestingExpectation() // Common instance for `TestingExpectation`
3536
);
3637
const t = new TestingCustom(
3738
[
@@ -46,8 +47,8 @@ if (execute) {
4647
TestingToBe,
4748
TestingToHave,
4849
],
49-
executeDescribe || Execute.describe["testing-custom"],
50-
executeIt || Execute.it["testing-custom"],
50+
executeDescribe || ExecuteSpec.describe["testing-custom"],
51+
executeIt || ExecuteSpec.it["testing-custom"],
5152
undefined,
5253
['describeA', 'describeB'],
5354
['itA', 'itB'],

src/test/testing-describe.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { TestingDescribe } from "../lib";
2-
import { Execute } from "./execute";
2+
import { ExecuteSpec } from "./execute";
33

4-
const execute = true;
4+
const execute = false;
55

66
if (execute) {
77
const range = (start: number, stop: number, step: number = 1) =>
@@ -11,7 +11,7 @@ if (execute) {
1111
);
1212

1313
const t = new TestingDescribe<'DescribeA' | 'FDescribe' | 'XDescribe'>(
14-
execute || Execute.describe["testing-describe"]
14+
execute || ExecuteSpec.describe["testing-describe"]
1515
);
1616

1717
console.log(t.counterActive); // true

0 commit comments

Comments
 (0)