mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-22 18:47:03 -05:00
Test/dacpac tests (#11428)
* Adding test for select operation page and dacpac wizard * skipping one test for investigation * Changes as per PR comments
This commit is contained in:
59
extensions/dacpac/src/test/selectOperationPage.test.ts
Normal file
59
extensions/dacpac/src/test/selectOperationPage.test.ts
Normal file
@@ -0,0 +1,59 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* 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);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user