MCPcopy Index your code
hub / github.com/simstudioai/sim / createAddBlockEntry

Function createAddBlockEntry

packages/testing/src/factories/undo-redo.factory.ts:139–183  ·  view source on GitHub ↗
(blockId: string, options: OperationEntryOptions = {})

Source from the content-addressed store, hash-verified

137 * Creates a mock batch-add-blocks operation entry.
138 */
139export function createAddBlockEntry(blockId: string, options: OperationEntryOptions = {}): any {
140 const {
141 id = shortId(8),
142 workflowId = 'wf-1',
143 userId = 'user-1',
144 createdAt = Date.now(),
145 } = options
146 const timestamp = Date.now()
147
148 const mockBlockSnapshot = {
149 id: blockId,
150 type: 'action',
151 name: `Block ${blockId}`,
152 position: { x: 0, y: 0 },
153 }
154
155 return {
156 id,
157 createdAt,
158 operation: {
159 id: shortId(8),
160 type: 'batch-add-blocks',
161 timestamp,
162 workflowId,
163 userId,
164 data: {
165 blockSnapshots: [mockBlockSnapshot],
166 edgeSnapshots: [],
167 subBlockValues: {},
168 },
169 },
170 inverse: {
171 id: shortId(8),
172 type: 'batch-remove-blocks',
173 timestamp,
174 workflowId,
175 userId,
176 data: {
177 blockSnapshots: [mockBlockSnapshot],
178 edgeSnapshots: [],
179 subBlockValues: {},
180 },
181 },
182 }
183}
184
185/**
186 * Creates a mock batch-remove-blocks operation entry.

Callers 1

store.test.tsFile · 0.90

Calls 1

shortIdFunction · 0.90

Tested by

no test coverage detected