Skip to content

Commit d44df9b

Browse files
authored
refactor(test): derive provider gateway facts from runtime builder (#2093)
1 parent ea1d6b8 commit d44df9b

2 files changed

Lines changed: 17 additions & 26 deletions

File tree

src/platform-runtime-gateway.fixtures.ts

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ import type {
1919
import type { PlatformRequestScope } from '@agent-device/contracts/platform-runtime-host';
2020
import type { DeviceInfo } from '@agent-device/kernel/device';
2121
import type { LimrunRuntimeDependencies } from '@agent-device/provider-limrun';
22-
import { unavailableDeploymentSnapshotAndShutdownOperationFacts } from './__tests__/test-utils/runtime-operation-facts.ts';
22+
import {
23+
createUnavailableRuntimeFactsForTest,
24+
unavailableDeploymentSnapshotAndShutdownOperationFacts,
25+
} from './__tests__/test-utils/runtime-operation-facts.ts';
2326
import {
2427
createComposedPlatformRuntimeGateway,
2528
type PlatformRuntimeProviderRegistration,
@@ -134,32 +137,12 @@ function binding(options: {
134137
function unavailableFacts() {
135138
const unavailable = { available: false, reason: 'unsupported-provider-mode' } as const;
136139
return {
140+
...createUnavailableRuntimeFactsForTest(
141+
gatewayFixtureDevice,
142+
providerRuntimeOwner('limrun', 'fixtures'),
143+
unavailable,
144+
).operations,
137145
...unavailableDeploymentSnapshotAndShutdownOperationFacts,
138-
appLogInspect: unavailable,
139-
appLogDoctor: unavailable,
140-
appLogStart: unavailable,
141-
appLogReattach: unavailable,
142-
appLogCleanup: unavailable,
143-
appState: unavailable,
144-
networkDump: unavailable,
145-
screenRecordingStart: unavailable,
146-
screenRecordingReattach: unavailable,
147-
screenRecordingCleanup: unavailable,
148-
ensureReady: unavailable,
149-
bootTarget: unavailable,
150-
bootTargetHeadless: unavailable,
151-
listApps: unavailable,
152-
...applicationLifecycleOperationFacts({
153-
resolveOpenTarget: unavailable,
154-
prepareApplicationOpen: unavailable,
155-
openApplication: unavailable,
156-
applyRuntimeHints: unavailable,
157-
clearRuntimeHints: unavailable,
158-
closeApplication: unavailable,
159-
finalizeApplicationClose: unavailable,
160-
prepareAppleRunner: unavailable,
161-
configureProviderPortReverse: unavailable,
162-
}),
163146
};
164147
}
165148

src/platform-runtime-gateway.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,14 @@ describe('composed platform runtime gateway', () => {
499499
});
500500

501501
const facts = await runtimeGateway.inspectFacts(device);
502+
expect(facts.operations.captureScreenshot).toMatchObject({
503+
available: false,
504+
reason: 'owner-capability-missing',
505+
});
506+
expect(facts.operations.appLogInspect).toMatchObject({
507+
available: false,
508+
reason: 'unsupported-provider-mode',
509+
});
502510
for (const operation of operations) {
503511
expect(facts.operations[operation].available).toBe(false);
504512
}

0 commit comments

Comments
 (0)