mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-05 19:41:12 +08:00
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>
23 lines
832 B
TypeScript
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;
|
|
}
|