A passenger has a confirmed train ticket open in your Super App. The confirmation offers to find a transit pass for the arrival city. While that screen is open, the transit partner releases a new Mini App with a different entry point. What happens when the passenger taps the old button?
This is a good regression test for a platform with independently released Mini Apps. The button can name a stable task. The host can resolve the destination when the passenger taps. The transit service receives enough information to show passes, and the host keeps the details it needs to take the passenger back to the original ticket.
In a FinClip-based deployment, FinClip supplies the Mini App runtime SDK, development tools and management platform. The Super App owner or its implementation partner builds the host routing behaviour below. The two service providers own their booking records. All functions in the example are ordinary JavaScript fixtures. You can exercise the proposed behaviour before connecting it to real Mini Apps. FinClip product overview
Store the task on the button
Save the two JavaScript blocks below in order in a file named handoff.test.mjs. They run on Node.js 24 using its built-in test runner. Node.js test runner documentation
Our button has two pieces of information. The task is the partner-independent name of the thing the passenger wants to do. The origin is a host-owned return route to the train confirmation. The host looks up the current train record so that the city and arrival date come from the booking. A successful lookup in the task directory gives it the supported cities and the current destination.
import assert from 'node:assert/strict' import test from 'node:test' const passTask = 'find-local-transit-passes' function makePassButton(bookingId) { return { task: passTask, origin: { screen: 'train-confirmation', bookingId } } } function returnToTrain(origin, readTrain, notice = null) { const ticket = readTrain(origin.bookingId) if (!ticket) return { screen: 'train-bookings', notice: 'Find your ticket' } return { screen: 'train-confirmation', ticket, notice } } async function follow(button, services) { const trainScreen = returnToTrain(button.origin, services.readTrain) if (!trainScreen.ticket) return trainScreen const { city, arrivalDate } = trainScreen.ticket const destination = services.lookup(button.task) if (!destination || !destination.cities.has(city)) { return { ...trainScreen, notice: 'No local pass offer for this arrival' } } const outcome = await services.enter({ miniApp: destination.miniApp, entry: destination.entry, input: { city, arrivalDate } }) if (outcome === 'unavailable') { return returnToTrain(button.origin, services.readTrain, 'Pass service unavailable') } if (outcome !== 'opened') throw new Error('Unknown navigation outcome') return { screen: 'partner', returnTo: button.origin } } There are two opportunities for a destination to disappear. The directory may already have withdrawn the city when the customer taps. A later withdrawal or a launch problem may also prevent entry after lookup succeeds. The host adapter translates a known failure to launch into unavailable. An unexpected adapter result remains visible as an error in this fixture. The application team can decide how to surface and report those errors in its host.
Notice what crosses the boundary in services.enter. The transit Mini App gets the arrival city and date. The host keeps the booking reference and return route. This separation gives the tests something more revealing to assert than whether the partner screen opened.
Change the destination after rendering the invitation
The fixture starts with a train booking and one directory entry. The test controls the directory independently of the rendered button. It also records everything sent to the transit Mini App. A small receipt in the train record makes it easy to verify that the handoff did not forward the whole object.
function setup() { const train = { id: 'T-17', city: 'York', arrivalDate: '2027-02-08', receipt: 'TRAIN-RECEIPT-17', platform: '4', status: 'confirmed' } const directory = new Map([[passTask, { miniApp: 'local-transit', entry: 'search', cities: new Set(['York', 'Leeds']) }]]) const attempts = [] const services = { readTrain: id => id === train.id ? { ...train } : null, lookup: task => directory.get(task), async enter(request) { attempts.push(request) return 'opened' } } return { train, directory, attempts, services, button: makePassButton(train.id) } } test('a normal handoff sends only the agreed arrival context', async () => { const f = setup() const screen = await follow(f.button, f.services) assert.equal(screen.screen, 'partner') assert.deepEqual(screen.returnTo, { screen: 'train-confirmation', bookingId: 'T-17' }) assert.deepEqual(f.attempts, [{ miniApp: 'local-transit', entry: 'search', input: { city: 'York', arrivalDate: '2027-02-08' } }]) }) test('an existing button opens the new entry after a partner release', async () => { const f = setup() f.directory.set(passTask, { ...f.directory.get(passTask), entry: 'choose-pass' }) const screen = await follow(f.button, f.services) assert.equal(screen.screen, 'partner') assert.equal(f.attempts[0].entry, 'choose-pass') }) for (const change of ['withdrawn service', 'unsupported city']) { test(change + ' leaves the confirmed train ticket available', async () => { const f = setup() const before = { ...f.train } if (change === 'withdrawn service') f.directory.delete(passTask) else f.directory.get(passTask).cities.delete('York') const screen = await follow(f.button, f.services) assert.equal(screen.screen, 'train-confirmation') assert.equal(screen.notice, 'No local pass offer for this arrival') assert.deepEqual(screen.ticket, before) assert.deepEqual(f.attempts, []) }) } test('a launch failure after lookup still gives the passenger a ticket', async () => { const f = setup() f.services.enter = async () => 'unavailable' const screen = await follow(f.button, f.services) assert.equal(screen.screen, 'train-confirmation') assert.equal(screen.ticket.id, 'T-17') assert.equal(screen.ticket.status, 'confirmed') assert.equal(screen.notice, 'Pass service unavailable') }) test('returning reloads the train record and leaves the pass order with transit', async () => { const f = setup() const transitEvents = [] f.services.enter = async request => { transitEvents.push({ action: 'open', city: request.input.city }) return 'opened' } const partner = await follow(f.button, f.services) assert.equal(partner.screen, 'partner') // The passenger chooses to buy on the partner screen. transitEvents.push({ action: 'order submitted', id: 'P-9', status: 'pending' }) f.train.platform = '6' const rail = returnToTrain(partner.returnTo, f.services.readTrain) assert.equal(rail.ticket.id, 'T-17') assert.equal(rail.ticket.platform, '6') assert.equal(rail.ticket.status, 'confirmed') assert.deepEqual(Object.keys(rail).sort(), ['notice', 'screen', 'ticket']) assert.deepEqual(transitEvents, [ { action: 'open', city: 'York' }, { action: 'order submitted', id: 'P-9', status: 'pending' } ]) }) Run node --test handoff.test.mjs. There are six tests. Two exercise the same fallback from different starting conditions. Withdrawing the entire service and dropping a single city may display similar copy, but the directory changes you need to support are different. A broad removal should not be the only available response to a local change.
The final test models separate owners for two records. The return function can read the train booking and sees the updated platform number. A passenger returning from a transit screen might already have started buying a pass. Navigating back supplies no evidence about the outcome of that purchase. In the fixture, the host return function has no write path to transit’s pending order. In an integrated test, read the actual test order on the transit side before and after the return and compare its history.
Take the test to the release rehearsal
Use an existing confirmed test booking. Leave the train Mini App open on a supported phone, change the transit entry in the test environment and tap the invitation that was already on the screen. Watch which destination receives the request and which fields arrive with it. Repeat on a city the provider withdrew, then try returning to the ticket after a platform change in the rail system.
The JavaScript fixture makes the host’s decisions observable. The rehearsal adds the realities of independent releases, cached directories, startup failures and native back navigation. If an old button still sends passengers to yesterday’s page, you now know which promise failed. The button was supposed to request a task. Only the host and receiving partner should need to know the name of today’s screen.