-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
extension/test/integration/7 - notification-provider.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import * as vscode from 'vscode' | ||
import * as sinon from 'sinon' | ||
import { StorageProvider } from "../../src/storage/storage-provider" | ||
import { NotificationProvider } from "../../src/ui/notification-provider" | ||
|
||
suite('notificaitons tests', () => { | ||
let mockGlobalState: vscode.Memento | ||
let storage: StorageProvider | ||
let notifications: NotificationProvider | ||
|
||
let fetchSpy: sinon.SinonSpy<any, any> | ||
let promptSpy: { | ||
info: sinon.SinonSpy<any, any> | ||
warning: sinon.SinonSpy<any, any> | ||
error: sinon.SinonSpy<any, any> | ||
} | ||
|
||
beforeEach(async function () { | ||
this.timeout(5000) | ||
|
||
let state = new Map<string, any>() | ||
mockGlobalState = { | ||
get: (key: string) => state.get(key), | ||
update: (key: string, value: any) => state.set(key, value), | ||
} as any | ||
storage = new StorageProvider(mockGlobalState) | ||
notifications = new NotificationProvider(storage) | ||
|
||
fetchSpy = sinon.stub(globalThis, 'fetch') | ||
promptSpy = { | ||
info: sinon.stub(vscode.window, 'showInformationMessage'), | ||
warning: sinon.stub(vscode.window, 'showWarningMessage'), | ||
error: sinon.stub(vscode.window, 'showErrorMessage'), | ||
} | ||
}) | ||
|
||
test('notifications are displayed', async function () { | ||
this.timeout(5000) | ||
|
||
notifications.activate() | ||
}) | ||
}) |