-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
### Packages impacted by this PR - @azure/notification-hubs ### Issues associated with this PR - #25914 ### Describe the problem that is addressed by this PR Updates code to fix the error code parsing for XML. ### What are the possible designs available to address the problem? If there are more than one possible design, why was the one in this PR chosen? ### Are there test cases added in this PR? _(If not, why?)_ ### Provide a list of related PRs _(if any)_ ### Command used to generate this PR:**_(Applicable only to SDK release request PRs)_ ### Checklists - [x] Added impacted package name to the issue description - [ ] Does this PR needs any fixes in the SDK Generator?** _(If so, create an Issue in the [Autorest/typescript](https://github.com/Azure/autorest.typescript) repository and link it here)_ - [x] Added a changelog (if necessary)
- Loading branch information
1 parent
fabe31a
commit 79e943f
Showing
3 changed files
with
30 additions
and
2 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
24 changes: 24 additions & 0 deletions
24
sdk/notificationhubs/notification-hubs/test/internal/unit/xmlUtils.spec.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,24 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
|
||
import { assert } from "@azure/test-utils"; | ||
import { parseXMLError } from "../../../src/utils/xmlUtils.js"; | ||
|
||
const NOTIFICATION_XML_ERROR = ` | ||
<Error> | ||
<Code>400</Code> | ||
<Detail>The HTTP header 'ServiceBusNotification-Format' has an invalid value: 'fcmlegacy'. Allowed values are 'windows', 'apple', 'gcm', 'template', 'adm', or 'windowsphone'.</Detail> | ||
</Error> | ||
`; | ||
|
||
describe("xmlUtils", () => { | ||
describe("parseXMLError", () => { | ||
it("should parse the error", async () => { | ||
const error = await parseXMLError(NOTIFICATION_XML_ERROR); | ||
assert.equal( | ||
error, | ||
"The HTTP header 'ServiceBusNotification-Format' has an invalid value: 'fcmlegacy'. Allowed values are 'windows', 'apple', 'gcm', 'template', 'adm', or 'windowsphone'." | ||
); | ||
}); | ||
}); | ||
}); |