Skip to content

Commit 6752dff

Browse files
Bill LeoutsakosBill Leoutsakos
authored andcommitted
fix(instagram): migrate insight metrics subblock
1 parent 6edf5dc commit 6752dff

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

apps/sim/lib/workflows/migrations/subblock-migrations.test.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,31 @@ function makeBlock(overrides: Partial<BlockState> & { type: string }): BlockStat
3636
}
3737

3838
describe('migrateSubblockIds', () => {
39+
it('should preserve Instagram insight metrics after the subblock rename', () => {
40+
const input: Record<string, BlockState> = {
41+
b1: makeBlock({
42+
type: 'instagram',
43+
subBlocks: {
44+
metrics: {
45+
id: 'metrics',
46+
type: 'short-input',
47+
value: 'reach,views',
48+
},
49+
},
50+
}),
51+
}
52+
53+
const { blocks, migrated } = migrateSubblockIds(input)
54+
55+
expect(migrated).toBe(true)
56+
expect(blocks.b1.subBlocks.insightMetrics).toEqual({
57+
id: 'insightMetrics',
58+
type: 'short-input',
59+
value: 'reach,views',
60+
})
61+
expect(blocks.b1.subBlocks.metrics).toBeUndefined()
62+
})
63+
3964
describe('knowledge block', () => {
4065
it('should rename knowledgeBaseId to knowledgeBaseSelector', () => {
4166
const input: Record<string, BlockState> = {

apps/sim/lib/workflows/migrations/subblock-migrations.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ const logger = createLogger('SubblockMigrations')
2323
* Format: { blockType: { oldSubblockId: newSubblockId } }
2424
*/
2525
export const SUBBLOCK_ID_MIGRATIONS: Record<string, Record<string, string>> = {
26+
instagram: {
27+
metrics: 'insightMetrics',
28+
},
2629
knowledge: {
2730
knowledgeBaseId: 'knowledgeBaseSelector',
2831
},

0 commit comments

Comments
 (0)