Skip to content

Commit

Permalink
Update Application.spec.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
aacebo committed Jan 12, 2024
1 parent 6ac6c3d commit c7266b9
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions js/packages/teams-ai/src/Application.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class MockUserTokenClient {
}

describe('Application', () => {
let sandbox: sinon.SinonSandbox;
const testAdapter = new TestAdapter();
const adaptiveCards: AdaptiveCardsOptions = { actionSubmitFilter: 'cardFilter' };
const ai: AIOptions<TurnState> = { planner: new TestPlanner() };
Expand All @@ -84,17 +85,17 @@ describe('Application', () => {
};

beforeEach(() => {
sinon.createSandbox();
sandbox = sinon.createSandbox();
});

afterEach(() => {
sinon.restore();
sandbox.restore();
});

describe('constructor()', () => {
it('should create an Application with default options', () => {
const app = new Application();
sinon.stub(app, 'adapter').get(() => testAdapter);
sandbox.stub(app, 'adapter').get(() => testAdapter);

assert.notEqual(app.options, undefined);
assert.equal(app.options.adapter, undefined);
Expand Down Expand Up @@ -251,7 +252,7 @@ describe('Application', () => {
authentication: authenticationSettings
});

sinon.stub(app, 'adapter').get(() => testAdapter);
sandbox.stub(app, 'adapter').get(() => testAdapter);
});

it('should return the authentication property', () => {
Expand Down Expand Up @@ -279,7 +280,7 @@ describe('Application', () => {
authentication: authSettings
});

sinon.stub(app, 'adapter').get(() => testAdapter);
sandbox.stub(app, 'adapter').get(() => testAdapter);

await testAdapter.sendTextToBot('signin', async (context) => {
// Set MockUserTokenClient on TurnState
Expand Down Expand Up @@ -346,7 +347,7 @@ describe('Application', () => {

beforeEach(() => {
app = new Application();
sinon.stub(app, 'adapter').get(() => testAdapter);
sandbox.stub(app, 'adapter').get(() => testAdapter);
});

it('should route to an activity handler', async () => {
Expand Down Expand Up @@ -422,7 +423,7 @@ describe('Application', () => {

beforeEach(() => {
app = new Application();
sinon.stub(app, 'adapter').get(() => testAdapter);
sandbox.stub(app, 'adapter').get(() => testAdapter);
});

it('should route to an instantiated conversationUpdate handler when channelId is Teams', async () => {
Expand Down Expand Up @@ -545,7 +546,7 @@ describe('Application', () => {

beforeEach(() => {
app = new Application();
sinon.stub(app, 'adapter').get(() => testAdapter);
sandbox.stub(app, 'adapter').get(() => testAdapter);
});

const messageReactions: { event: MessageReactionEvents; testActivity: Partial<Activity> }[] = [
Expand Down Expand Up @@ -619,7 +620,7 @@ describe('Application', () => {

beforeEach(() => {
app = new Application();
sinon.stub(app, 'adapter').get(() => testAdapter);
sandbox.stub(app, 'adapter').get(() => testAdapter);
});

it('should route to correct handler for fileConsentAccept', async () => {
Expand Down Expand Up @@ -678,7 +679,7 @@ describe('Application', () => {

beforeEach(() => {
app = new Application();
sinon.stub(app, 'adapter').get(() => testAdapter);
sandbox.stub(app, 'adapter').get(() => testAdapter);
});

it('should route to correct handler for fileConsentDecline', async () => {
Expand Down Expand Up @@ -724,7 +725,7 @@ describe('Application', () => {

beforeEach(() => {
app = new Application();
sinon.stub(app, 'adapter').get(() => testAdapter);
sandbox.stub(app, 'adapter').get(() => testAdapter);
});

it('should route to correct handler for O365ConnectorCardAction', async () => {
Expand Down Expand Up @@ -757,7 +758,7 @@ describe('Application', () => {

beforeEach(() => {
app = new Application();
sinon.stub(app, 'adapter').get(() => testAdapter);
sandbox.stub(app, 'adapter').get(() => testAdapter);
});

const messageUpdateEvents: { event: TeamsMessageEvents; testActivity: Partial<Activity> }[] = [
Expand Down Expand Up @@ -824,7 +825,7 @@ describe('Application', () => {

beforeEach(() => {
app = new Application();
sinon.stub(app, 'adapter').get(() => testAdapter);
sandbox.stub(app, 'adapter').get(() => testAdapter);
});

it('should route to correct handler for teamsReadReceipt', async () => {
Expand Down

0 comments on commit c7266b9

Please sign in to comment.