-
Notifications
You must be signed in to change notification settings - Fork 378
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add schema diff UT & add null checking in deleteTrigger (#2856)
* null checking in deleteTrigger * add UT for getCustomSchema * fix ts type Co-authored-by: Ben Yackley <61990921+beyackle@users.noreply.github.com> Co-authored-by: Andy Brown <asbrown002@gmail.com> Co-authored-by: Chris Whitten <christopher.whitten@microsoft.com>
- Loading branch information
1 parent
c9496ed
commit 9d221cf
Showing
4 changed files
with
59 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
Composer/packages/extensions/visual-designer/__tests__/utils/getCustomSchema.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
import { OBISchema } from '@bfc/shared'; | ||
|
||
import { getCustomSchema } from '../../src/utils/getCustomSchema'; | ||
|
||
describe('getCustomSchema', () => { | ||
it('can handle invalid input', () => { | ||
expect(getCustomSchema()).toBeUndefined(); | ||
expect(getCustomSchema({}, undefined)).toBeUndefined(); | ||
expect(getCustomSchema(undefined, undefined)).toBeUndefined(); | ||
|
||
expect(getCustomSchema({}, {})).toBeUndefined(); | ||
}); | ||
|
||
it('can genreate diff schema', () => { | ||
const ejected = { | ||
definitions: { | ||
'Microsoft.SendActivity': { | ||
title: 'SendActivity Title', | ||
description: 'Send an activity.', | ||
}, | ||
}, | ||
} as OBISchema; | ||
expect(getCustomSchema({ oneOf: [], definitions: {} }, ejected)).toEqual({ | ||
oneOf: [ | ||
{ | ||
title: 'SendActivity Title', | ||
description: 'Send an activity.', | ||
$ref: '#/definitions/Microsoft.SendActivity', | ||
}, | ||
], | ||
definitions: { | ||
'Microsoft.SendActivity': ejected.definitions['Microsoft.SendActivity'], | ||
}, | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters