Skip to content

Commit 2ec5d84

Browse files
test(object): use strict and add descriptor
1 parent 786bc11 commit 2ec5d84

1 file changed

Lines changed: 28 additions & 11 deletions

File tree

packages/type/src/testing/variables/object.const.ts

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
import { SYMBOL_NUMBER, SYMBOL_STRING } from './symbol.const';
2-
import { STRING } from './string.const';
1+
// Variables.
32
import { NUMBER } from './number.const';
4-
export interface ObjectOne {
5-
'key as string'?: boolean;
6-
1030405027?: string;
7-
5?: string;
8-
[SYMBOL_NUMBER]?: string;
9-
[SYMBOL_STRING]?: number;
10-
x: number;
11-
}
12-
export interface ObjectTwo { x: string; y: number; }
3+
import { STRING } from './string.const';
4+
import { SYMBOL_NUMBER, SYMBOL_STRING } from './strict/symbol.const';
5+
// Interface.
6+
import { DataDescriptor, } from '../interface';
7+
import { ObjectOne, ObjectTwo } from '../interface';
8+
// Type.
9+
import { ThisAccessorDescriptor } from '../type/this-accessor-descriptor.type'
10+
1311
/**
1412
* @example https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Working_with_Objects
1513
*/
@@ -65,3 +63,22 @@ export const OBJECT_ONE_NEW = new Object(OBJECT_ONE);
6563
* instanceof Symbol === false
6664
*/
6765
export const OBJECT_TWO_NEW = new Object(OBJECT_TWO);
66+
67+
68+
export const DATA_DESCRIPTOR: DataDescriptor<string> = {
69+
configurable: true,
70+
enumerable: true,
71+
writable: true,
72+
value: 'my value'
73+
}
74+
75+
export const ACCESSOR_DESCRIPTOR: ThisAccessorDescriptor<string | undefined, ObjectOne> = {
76+
configurable: true,
77+
enumerable: true,
78+
get(): string | undefined {
79+
return this[5];
80+
},
81+
set(value: string | undefined) {
82+
this[5] = value;
83+
}
84+
}

0 commit comments

Comments
 (0)