Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Commit

Permalink
Track the changes in the workspace-specific configuration files
Browse files Browse the repository at this point in the history
Signed-off-by: Artem Zatsarynnyi <[email protected]>
  • Loading branch information
azatsarynnyy committed Apr 30, 2021
1 parent 3f471a1 commit 58c71a5
Showing 1 changed file with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ import { WorkspaceService } from '@theia/workspace/lib/browser';
describe('Test workspace config files watchers', function () {
let container: Container;

let fileService: FileService;
let workspaceService: WorkspaceService;

const fileServiceWatchMethod = jest.fn();
const workspaceServiceRootsProp = jest.fn();
const workspaceServiceOnWorkspaceChangedMethod = jest.fn();

beforeEach(() => {
Expand All @@ -35,12 +37,11 @@ describe('Test workspace config files watchers', function () {

container = new Container();

const fileService = ({
fileService = ({
watch: fileServiceWatchMethod,
} as unknown) as FileService;

const workspaceService = ({
roots: workspaceServiceRootsProp,
workspaceService = ({
onWorkspaceChanged: workspaceServiceOnWorkspaceChangedMethod,
} as unknown) as WorkspaceService;

Expand Down Expand Up @@ -91,13 +92,15 @@ describe('Test workspace config files watchers', function () {
resource: resource,
},
];
workspaceServiceRootsProp.mockResolvedValue(roots);

Object.defineProperty(workspaceService, 'roots', {
get: jest.fn(() => roots),
});

await devfileWatcher.onStart({} as FrontendApplication);

// expect(fileServiceWatchMethod.mock.calls.length).toEqual(1);
expect(fileServiceWatchMethod).toHaveBeenCalled();
// expect(fileServiceWatchMethod).toHaveBeenCalledWith(resource);
expect(fileServiceWatchMethod.mock.calls.length).toEqual(1);
expect(fileServiceWatchMethod).toHaveBeenCalledWith(resource);
});
});
});

0 comments on commit 58c71a5

Please sign in to comment.