Files
react-native-devtools-frontend/front_end/testing/FileManagerHelpers.ts
T
Benedikt Meurer b328d4758d [eslint] Migrate front_end/{entrypoints,models} to CONSTANT_CASE enum values.
Note that this only migrates the code, but doesn't yet change the
ESLint configuration, since other folders are still pending.

Bug: 361720369
Change-Id: I3ffef5a9a16710dfcf922ec709eb8ce187d78301
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5803050
Reviewed-by: Nikolay Vitkov <nvitkov@chromium.org>
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Nikolay Vitkov <nvitkov@chromium.org>
2024-08-23 14:43:41 +00:00

23 lines
832 B
TypeScript

// Copyright 2024 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import * as Workspace from '../models/workspace/workspace.js';
type StubbedFileManager = Workspace.FileManager.FileManager&{
save: sinon.SinonStub,
append: sinon.SinonStub,
close: sinon.SinonStub,
};
export function stubFileManager(): StubbedFileManager {
const fileManager = Workspace.FileManager.FileManager.instance() as StubbedFileManager;
sinon.stub(fileManager, 'save').callsFake(async (file, _2, _3) => ({fileSystemPath: file}));
sinon.stub(fileManager, 'append').callsFake(file => {
fileManager.dispatchEventToListeners(Workspace.FileManager.Events.APPENDED_TO_URL, file);
});
sinon.stub(fileManager, 'close');
return fileManager;
}