Files
azuredatastudio/extensions/dacpac/src/test/selectOperationPage.test.ts
Udeesha Gautam 921beebd79 Test/dacpac tests (#11428)
* Adding test for select operation page and dacpac wizard

* skipping one test for investigation

* Changes as per PR comments
2020-07-20 14:23:27 -07:00

60 lines
2.6 KiB
TypeScript

/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import 'mocha';
import * as should from 'should';
import * as loc from '../localizedConstants';
import { DataTierApplicationWizard, PageName } from '../wizard/dataTierApplicationWizard';
import { DacFxDataModel } from '../wizard/api/models';
import { TestContext, createContext } from './testContext';
import { TestSelectOperationPage } from './testDacFxConfigPages';
let wizard: DataTierApplicationWizard;
let testContext: TestContext;
describe('Dacpac Select OperationPage Tests', function (): void {
beforeEach(async function (): Promise<void> {
wizard = new DataTierApplicationWizard();
wizard.model = <DacFxDataModel>{};
wizard.model.server = undefined;
});
it('Select Operations Page should start correctly', async () => {
testContext = createContext();
wizard.setPages();
const opPage: TestSelectOperationPage = new TestSelectOperationPage(wizard, wizard.pages.get(PageName.selectOperation).wizardPage, wizard.model, testContext.viewContext.view);
const onPageStart = await opPage.start();
const onPageEnter = await opPage.onPageEnter();
should(onPageStart).equal(true);
should(onPageEnter).equal(true);
should(opPage.WizardState.wizard.pages.length).equal(4);
should(opPage.WizardState.wizard.pages[1].title).equal(loc.deployConfigPageName);
should(opPage.WizardState.wizard.pages[2].title).equal(loc.deployPlanPageName);
should(opPage.WizardState.wizard.pages[3].title).equal(loc.summaryPageName);
});
it('Select Operations Page clicks should work correctly', async () => {
testContext = createContext();
wizard.setPages();
const opPage: TestSelectOperationPage = new TestSelectOperationPage(wizard, wizard.pages.get(PageName.selectOperation).wizardPage, wizard.model, testContext.viewContext.view);
await opPage.start();
testContext.viewContext.extractOnClick.fire(undefined);
should(opPage.WizardState.wizard.doneButton.label).equal(loc.extract);
testContext.viewContext.exportOnClick.fire(undefined);
should(opPage.WizardState.wizard.doneButton.label).equal(loc.exportText);
testContext.viewContext.importOnClick.fire(undefined);
should(opPage.WizardState.wizard.doneButton.label).equal(loc.importText);
testContext.viewContext.deployOnClick.fire(undefined);
should(opPage.WizardState.wizard.doneButton.label).equal(loc.deploy);
});
});