-
-
Notifications
You must be signed in to change notification settings - Fork 381
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: test Arduino state update for extensions
Signed-off-by: Akos Kitta <[email protected]>
- Loading branch information
Akos Kitta
committed
Dec 13, 2023
1 parent
615a684
commit e149eaa
Showing
7 changed files
with
716 additions
and
11 deletions.
There are no files selected for viewing
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
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
23 changes: 20 additions & 3 deletions
23
arduino-ide-extension/src/test/browser/browser-test-bindings.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 |
---|---|---|
@@ -1,8 +1,25 @@ | ||
import { MockLogger } from '@theia/core/lib/common/test/mock-logger'; | ||
import { Container, ContainerModule } from '@theia/core/shared/inversify'; | ||
import { bindCommon } from '../common/common-test-bindings'; | ||
import { | ||
Bind, | ||
ConsoleLogger, | ||
bindCommon, | ||
} from '../common/common-test-bindings'; | ||
|
||
export function createBaseContainer(): Container { | ||
export function createBaseContainer(bind: Bind = bindBrowser): Container { | ||
const container = new Container({ defaultScope: 'Singleton' }); | ||
container.load(new ContainerModule((bind) => bindCommon(bind))); | ||
container.load(new ContainerModule(bind)); | ||
return container; | ||
} | ||
|
||
export const bindBrowser: Bind = function ( | ||
...args: Parameters<Bind> | ||
): ReturnType<Bind> { | ||
bindCommon(...args); | ||
const [bind, , , rebind] = args; | ||
// IDE2's test console logger does not support `Loggable` arg. | ||
// Rebind logger to suppress `[Function (anonymous)]` messages in tests when the storage service is initialized without `window.localStorage`. | ||
// https://github.com/eclipse-theia/theia/blob/04c8cf07843ea67402131132e033cdd54900c010/packages/core/src/browser/storage-service.ts#L60 | ||
bind(MockLogger).toSelf().inSingletonScope(); | ||
rebind(ConsoleLogger).toService(MockLogger); | ||
}; |
Oops, something went wrong.