@@ -17,32 +17,32 @@ import { expect } from 'chai';
1717import { describe , it , beforeEach , afterEach } from "mocha" ;
1818import * as sinon from 'sinon' ;
1919import * as vscode from 'vscode' ;
20- import { Extension } from 'vscode' ;
20+ import { Extension } from 'vscode' ;
2121import { LOGGER } from '../../../logger' ;
22- import { mock , instance , when , reset } from "ts-mockito" ;
23- var l10n :any = null ;
22+ import { mock , instance , when , reset } from "ts-mockito" ;
23+ var l10n : any = null ;
2424import * as path from 'path' ;
2525import assert = require( 'assert' ) ;
2626
2727describe ( 'localiser tests' , ( ) => {
2828 let loggerLogStub : sinon . SinonStub ;
29- let mockedExtns : typeof vscode . extensions ;
30- let extMock : Extension < any > ;
31- let mockedEnv : typeof vscode . env ;
32- let mockedL10n : typeof vscode . l10n ;
29+ let mockedExtns : typeof vscode . extensions ;
30+ let extMock : Extension < any > ;
31+ let mockedEnv : typeof vscode . env ;
32+ let mockedL10n : typeof vscode . l10n ;
3333 let currentDir = __dirname ;
34-
34+
3535 before ( ( ) => {
36- let vscodeObj = ( vscode as typeof vscode & { mockedExtns : typeof vscode . extensions , mockedEnv : typeof vscode . env , mockedL10n : typeof vscode . l10n } ) ;
36+ let vscodeObj = ( vscode as typeof vscode & { mockedExtns : typeof vscode . extensions , mockedEnv : typeof vscode . env , mockedL10n : typeof vscode . l10n } ) ;
3737 mockedExtns = vscodeObj . mockedExtns ;
3838 mockedEnv = vscodeObj . mockedEnv ;
3939 mockedL10n = vscodeObj . mockedL10n ;
4040 extMock = mock < Extension < any > > ( ) ;
41- loggerLogStub = sinon . stub ( LOGGER , "error" ) ;
42-
43-
41+ loggerLogStub = sinon . stub ( LOGGER , "error" ) ;
42+
43+
4444 } ) ;
45- beforeEach ( ( ) => {
45+ beforeEach ( ( ) => {
4646 sinon . reset ( ) ;
4747 reset ( mockedExtns ) ;
4848 reset ( extMock ) ;
@@ -61,32 +61,32 @@ describe('localiser tests', () => {
6161 describe ( 'l10n tests' , ( ) => {
6262 describe ( 'issue while reading bundle' , ( ) => {
6363 it ( 'file not found error' , ( ) => {
64- let msg :string | null = null ;
64+ let msg : string | null = null ;
6565 when ( extMock ?. extensionPath ) . thenReturn ( path . join ( currentDir , 'doesnt-exist' ) ) ;
6666 var mkInst = instance ( extMock ) ;
6767 when ( mockedExtns . getExtension ( "oracle.oracle-java" ) ) . thenReturn ( mkInst ) ;
68- try {
68+ try {
6969 l10n = require ( '../../../localiser' ) ;
70- } catch ( e ) {
71- msg = ( e as any & { message :string } ) . message
70+ } catch ( e ) {
71+ msg = ( e as any & { message : string } ) . message
7272 }
73- assert . strictEqual ( msg ! ! . includes ( "no such file or directory" ) , true ) ;
73+ assert . strictEqual ( msg ! ! . includes ( "no such file or directory" ) , true ) ;
7474 expect ( loggerLogStub . called ) . to . be . true ;
7575 } ) ;
7676 it ( 'file parsing error' , ( ) => {
77- let msg :string | null = null ;
78- when ( extMock ?. extensionPath ) . thenReturn ( path . join ( currentDir , 'resources' , 'corrupt' ) ) ;
77+ let msg : string | null = null ;
78+ when ( extMock ?. extensionPath ) . thenReturn ( path . join ( currentDir , 'resources' , 'corrupt' ) ) ;
7979 var mkInst = instance ( extMock ) ;
8080 when ( mockedExtns . getExtension ( "oracle.oracle-java" ) ) . thenReturn ( mkInst ) ;
81- try {
81+ try {
8282 l10n = require ( '../../../localiser' ) ;
83- } catch ( e ) {
84- msg = ( e as any & { message :string } ) . message
83+ } catch ( e ) {
84+ msg = ( e as any & { message : string } ) . message
8585 }
86- assert . strictEqual ( msg ! ! . includes ( "Bad control character in string literal in JSON" ) , true ) ;
86+ assert . strictEqual ( msg ! ! . includes ( "Bad control character in string literal in JSON" ) , true ) ;
8787 expect ( loggerLogStub . called ) . to . be . true ;
8888 } ) ;
89-
89+
9090 } ) ;
9191 describe ( 'l10n initialisation tests' , ( ) => {
9292 it ( 'l10n initialized' , ( ) => {
@@ -103,10 +103,10 @@ describe('localiser tests', () => {
103103 when ( mockedExtns . getExtension ( "oracle.oracle-java" ) ) . thenReturn ( mkExtInst ) ;
104104 when ( mockedL10n . bundle ) . thenReturn ( undefined ) ;
105105 let l10n = require ( '../../../localiser' ) ;
106- let l10nObj = l10n . l10n as { nbLocaleCode ( ) : string , value ( key : string , placeholderMap ?: Record < string , any > ) : string } ;
107- assert . strictEqual ( l10nObj . nbLocaleCode ( ) , "en" ) ;
108- assert . strictEqual ( l10nObj . value ( "label1" ) , "label1 description" ) ;
109- assert . strictEqual ( l10nObj . value ( "label2" , { "placeholder1" :"sample data" } ) , "lable2 sample data description" ) ;
106+ let l10nObj = l10n . l10n as { nbLocaleCode ( ) : string , value ( key : string , placeholderMap ?: Record < string , any > ) : string } ;
107+ assert . strictEqual ( l10nObj . nbLocaleCode ( ) , "en" ) ;
108+ assert . strictEqual ( l10nObj . value ( "label1" ) , "label1 description" ) ;
109+ assert . strictEqual ( l10nObj . value ( "label2" , { "placeholder1" : "sample data" } ) , "lable2 sample data description" ) ;
110110 expect ( loggerLogStub . called ) . to . be . false ;
111111 } ) ;
112112 } ) ;
0 commit comments