proxy.test.ts — svelte Source File
Architecture documentation for proxy.test.ts, a typescript file in the svelte codebase. 3 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 7227d5bc_9d91_206c_bca5_1ec8553c6070["proxy.test.ts"] 71020d3b_ab64_9fea_2a06_dab93412f92f["proxy.js"] 7227d5bc_9d91_206c_bca5_1ec8553c6070 --> 71020d3b_ab64_9fea_2a06_dab93412f92f c55b2607_d45b_c327_8826_7bdf245d80f6["proxy"] 7227d5bc_9d91_206c_bca5_1ec8553c6070 --> c55b2607_d45b_c327_8826_7bdf245d80f6 b63ddb92_634c_990b_eb1b_0bad8a4d434e["vitest"] 7227d5bc_9d91_206c_bca5_1ec8553c6070 --> b63ddb92_634c_990b_eb1b_0bad8a4d434e style 7227d5bc_9d91_206c_bca5_1ec8553c6070 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { proxy } from './proxy';
import { assert, test } from 'vitest';
test('does not mutate the original object', () => {
const original = { x: 1 };
const state = proxy(original);
state.x = 2;
assert.equal(original.x, 1);
assert.equal(state.x, 2);
});
test('preserves getters', () => {
let count = 0;
const original = {
count: 0,
get x() {
this.count += 1;
count += 1;
return 42;
}
};
const state = proxy(original);
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
state.x;
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
state.x;
assert.equal(original.count, 0);
assert.equal(count, 2);
assert.equal(state.count, 2);
});
test('defines a property', () => {
const original = { y: 0 };
const state = proxy<any>(original);
let value = 0;
Object.defineProperty(state, 'x', {
value: 1
});
Object.defineProperty(state, 'y', {
value: 1
});
assert.equal(state.x, 1);
assert.deepEqual(Object.getOwnPropertyDescriptor(state, 'x'), {
configurable: true,
writable: true,
value: 1,
enumerable: true
});
assert.ok(!('x' in original));
assert.deepEqual(Object.getOwnPropertyDescriptor(original, 'y'), {
configurable: true,
// ... (74 more lines)
Domain
Source
Frequently Asked Questions
What does proxy.test.ts do?
proxy.test.ts is a source file in the svelte codebase, written in typescript. It belongs to the ClientRuntime domain.
What does proxy.test.ts depend on?
proxy.test.ts imports 3 module(s): proxy, proxy.js, vitest.
Where is proxy.test.ts in the architecture?
proxy.test.ts is located at packages/svelte/src/internal/client/proxy.test.ts (domain: ClientRuntime, directory: packages/svelte/src/internal/client).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free