Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('Should return notify client when resource changed underneath', done => {
userStorageResource.onDidChangeContents(() => {
done();
});
mockOnFileChangedEmitter.fire([
{
type: FileChangeType.UPDATED,
uri: userStorageFolder.resolve(testFile)
}
]);
}).timeout(2000);
it('Should register a client and notifies it of the fs changesby converting them to user storage changes', done => {
userStorageService.onUserStorageChanged(event => {
const userStorageUri = event.uris[0];
expect(userStorageUri.scheme).eq(UserStorageUri.SCHEME);
expect(userStorageUri.path.toString()).eq(testFile);
done();
});
mockOnFileChangedEmitter.fire([
{
type: FileChangeType.UPDATED,
uri: userStorageFolder.resolve(testFile)
}
]);
}).timeout(2000);
protected onFilesChangedEventHandler(changes: FileChangeEvent): void {
for (const change of changes) {
switch (change.type) {
case FileChangeType.UPDATED:
for (const [id, subscriber] of this.subscribers) {
if (!subscriber.ignoreChangeEvents && this.uriMatches(subscriber, change)) {
subscriber.proxy.$fileChanged({ subscriberId: id, uri: theiaUritoUriComponents(change.uri), type: 'updated' });
}
}
break;
case FileChangeType.ADDED:
for (const [id, subscriber] of this.subscribers) {
if (!subscriber.ignoreCreateEvents && this.uriMatches(subscriber, change)) {
subscriber.proxy.$fileChanged({ subscriberId: id, uri: theiaUritoUriComponents(change.uri), type: 'created' });
}
}
break;
case FileChangeType.DELETED:
for (const [id, subscriber] of this.subscribers) {
if (!subscriber.ignoreDeleteEvents && this.uriMatches(subscriber, change)) {