import { expect } from 'chai' ; import * as vscode from 'vscode' ; const PERFECT_MATCH = 10 ; async function matchExtensionAsHtml ( extension ) { const doc = await vscode . workspace . openTextDocument ( vscode . Uri . parse ( `untitled:fake/path/doc.${ extension }` ) ) ; expect ( vscode . languages . match ( { language : 'html' } , doc ) ) . to . equal ( PERFECT_MATCH ) ; } describe ( 'Lightning file association' , ( ) => { it ( 'Should support .app association' , async ( ) => { await matchExtensionAsHtml ( '.app' ) ; } ) ; it ( 'Should support .cmp association' , async ( ) => { await matchExtensionAsHtml ( '.cmp' ) ; } ) ; it ( 'Should support .design association' , async ( ) => { await matchExtensionAsHtml ( '.design' ) ; } ) ; it ( 'Should support .evt association' , async ( ) => { await matchExtensionAsHtml ( '.evt' ) ; } ) ; it ( 'Should support.intf association' , async ( ) => { await matchExtensionAsHtml ( '.intf' ) ; } ) ; it ( 'Should support .auradoc association' , async ( ) => { await matchExtensionAsHtml ( '.auradoc' ) ; } ) ; it ( 'Should support .tokens association' , async ( ) => { await matchExtensionAsHtml ( '.tokens' ) ; } ) ; } ) ; describe ( 'Test commands' , ( ) => { let coreExtension ; let auraExtension ; before ( async ( ) => { if ( vscode . workspace && vscode . workspace . workspaceFolders && vscode . workspace . workspaceFolders [ 0 ] ) { coreExtension = vscode . extensions . getExtension ( 'salesforce.salesforcedx-vscode-core' ) as vscode . Extension < any > ; auraExtension = vscode . extensions . getExtension ( 'salesforce.salesforcedx-vscode-lightning' ) as vscode . Extension < any > ; } } ) ; it ( 'coreExtension activation' , async function ( ) { this . timeout ( 10000 ) ; await coreExtension . activate ( ) ; expect ( coreExtension . isActive ) ; } ) ; it ( 'aura activation' , async function ( ) { this . timeout ( 10000 ) ; await auraExtension . activate ( ) ; expect ( auraExtension . isActive ) ; } ) ; } ) ;