-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
/
exec.js
41 lines (33 loc) 路 983 Bytes
/
exec.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
// class Foo {
// constructor(status) {
// this.status = status;
// expect(() => this.#getStatus = null).toThrow(TypeError);
// }
// #getStatus() {
// return this.status;
// }
// getCurrentStatus() {
// return this.#getStatus();
// }
// setCurrentStatus(newStatus) {
// this.status = newStatus;
// }
// getFakeStatus(fakeStatus) {
// const getStatus = this.#getStatus;
// return function() {
// return getStatus.call({ status: fakeStatus });
// };
// }
// getFakeStatusFunc() {
// return {
// status: 'fake-status',
// getFakeStatus: this.#getStatus,
// };
// }
// }
// const f = new Foo('inactive');
// expect(f.getCurrentStatus()).toBe('inactive');
// f.setCurrentStatus('new-status');
// expect(f.getCurrentStatus()).toBe('new-status');
// expect(f.getFakeStatus('fake')()).toBe('fake');
// expect(f.getFakeStatusFunc().getFakeStatus()).toBe('fake-status');