Testing Dynamic Sync Formulas

I’d like to write integration tests for dynamic sync formulas but without a selection step the dynamicUrl is never set. Is there a way to set this manually for testing and still use a live execution context?

A naive approach as below throws when attempting to assign.

  let ctx: SyncExecutionContext;

  ctx = newRealFetcherSyncExecutionContext(pack, require.resolve('../../pack'));

  ctx.sync.dynamicUrl = 'https://api.example.com/123';

I also see that there’s a testing utility to execute Metadata Formulas, but can’t quite figure out how I could run listDynamicUrls() and have the value passed to context.

Anyone else run into this scenario?

Hi @Micah_Cotton - I think your approach is correctly, but it appears there is a bug in newRealFetcherSyncExecutionContext()that is causing an endless loop. Let me submit a fix for that and I’ll update this thread once it is in.

I just submitted a fix for that bug, but it isn’t in an NPM release yet. In the mean time you can install the SDK directly from the GitHub repo at this commit using:

npm install https://github.com/coda/packs-sdk.git#ef7131c82fcf7f974b0c9865e7de89d55cd1883f

Amazing, thank you @Eric_Koleda !