mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-12 19:52:51 +00:00
20 lines
568 B
TypeScript
20 lines
568 B
TypeScript
import { describe, it, expect } from 'vitest';
|
|
import { nonSetterProxy } from '../../src/utils/non-setter-proxy';
|
|
|
|
describe('nonSetterProxy', () => {
|
|
it('should non setter on proxy', () => {
|
|
const target = { a: 1 };
|
|
const proxy = nonSetterProxy(target);
|
|
|
|
expect(() => ((proxy as any).b = 1)).toThrowError(/trap returned falsish for property 'b'/);
|
|
});
|
|
|
|
it('should correct value when getter', () => {
|
|
const target = { a: 1 };
|
|
const proxy = nonSetterProxy(target);
|
|
|
|
expect(proxy.a).toBe(1);
|
|
expect('a' in proxy).toBeTruthy();
|
|
});
|
|
});
|