Skip to content

Commit

Permalink
[Communication][SMS] Fix test, update recordings (#32402)
Browse files Browse the repository at this point in the history
### Packages impacted by this PR
SMS

### Issues associated with this PR
#32393

### Describe the problem that is addressed by this PR
Fix the tests and upload recordings

### 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
- [ ] 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)_
- [ ] Added a changelog (if necessary)
  • Loading branch information
phermanov-msft authored Jan 2, 2025
1 parent c1bcf2b commit 7642987
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion sdk/communication/communication-sms/assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "js",
"TagPrefix": "js/communication/communication-sms",
"Tag": "js/communication/communication-sms_89bfd33ddf"
"Tag": "js/communication/communication-sms_b4dbaf2de3"
}
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ matrix([[false, true]], async function (useAad: boolean) {
const results = await client.optOuts.check(fromNumber, [validToNumber]);

assert.lengthOf(results, 1, "must return as many results as there were recipients");
assert.equal(200, results[0].httpStatusCode);
assert.equal(results[0].httpStatusCode, 200);
},
);

Expand All @@ -193,7 +193,7 @@ matrix([[false, true]], async function (useAad: boolean) {
const results = await client.optOuts.add(fromNumber, [validToNumber]);

assert.lengthOf(results, 1, "must return as many results as there were recipients");
assert.equal(200, results[0].httpStatusCode);
assert.equal(results[0].httpStatusCode, 200);
},
);

Expand All @@ -206,7 +206,7 @@ matrix([[false, true]], async function (useAad: boolean) {
const results = await client.optOuts.remove(fromNumber, [validToNumber]);

assert.lengthOf(results, 1, "must return as many results as there were recipients");
assert.equal(200, results[0].httpStatusCode);
assert.equal(results[0].httpStatusCode, 200);
},
);

Expand All @@ -215,23 +215,23 @@ matrix([[false, true]], async function (useAad: boolean) {
const validToNumber = env.AZURE_PHONE_NUMBER as string;

const addResults = await client.optOuts.add(fromNumber, [validToNumber]);
assert.equal(200, addResults[0].httpStatusCode);
assert.equal(addResults[0].httpStatusCode, 200);

const checkResults = await client.optOuts.check(fromNumber, [validToNumber]);
assert.equal(200, checkResults[0].httpStatusCode);
assert.equal(true, checkResults[0].isOptedOut);
assert.equal(checkResults[0].httpStatusCode, 200);
assert.equal(checkResults[0].isOptedOut, true);
});

it("OptOut Remove should mark recipient as opted in", { timeout: 4000 }, async () => {
const fromNumber = env.AZURE_PHONE_NUMBER as string;
const validToNumber = env.AZURE_PHONE_NUMBER as string;

const removeResults = await client.optOuts.remove(fromNumber, [validToNumber]);
assert.equal(200, removeResults[0].httpStatusCode);
assert.equal(removeResults[0].httpStatusCode, 200);

const checkResults = await client.optOuts.check(fromNumber, [validToNumber]);
assert.equal(200, checkResults[0].httpStatusCode);
assert.equal(false, checkResults[0].isOptedOut);
assert.equal(checkResults[0].httpStatusCode, 200);
assert.equal(checkResults[0].isOptedOut, false);
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ matrix([[false, true]], async function (useAad: boolean) {
const results = await client.optOuts.check(fromNumber, [validToNumber]);

assert.lengthOf(results, 1, "must return as many results as there were recipients");
assert.equal(200, results[0].httpStatusCode);
assert.equal(results[0].httpStatusCode, 200);
},
);

Expand All @@ -194,7 +194,7 @@ matrix([[false, true]], async function (useAad: boolean) {
const results = await client.optOuts.add(fromNumber, [validToNumber]);

assert.lengthOf(results, 1, "must return as many results as there were recipients");
assert.equal(200, results[0].httpStatusCode);
assert.equal(results[0].httpStatusCode, 200);
},
);

Expand All @@ -207,7 +207,7 @@ matrix([[false, true]], async function (useAad: boolean) {
const results = await client.optOuts.remove(fromNumber, [validToNumber]);

assert.lengthOf(results, 1, "must return as many results as there were recipients");
assert.equal(200, results[0].httpStatusCode);
assert.equal(results[0].httpStatusCode, 200);
},
);

Expand All @@ -216,23 +216,23 @@ matrix([[false, true]], async function (useAad: boolean) {
const validToNumber = env.AZURE_PHONE_NUMBER as string;

const addResults = await client.optOuts.add(fromNumber, [validToNumber]);
assert.equal(200, addResults[0].httpStatusCode);
assert.equal(addResults[0].httpStatusCode, 200);

const checkResults = await client.optOuts.check(fromNumber, [validToNumber]);
assert.equal(200, checkResults[0].httpStatusCode);
assert.equal(true, checkResults[0].isOptedOut);
assert.equal(checkResults[0].httpStatusCode, 200);
assert.equal(checkResults[0].isOptedOut, true);
});

it("OptOut Remove should mark recipient as opted in", { timeout: 4000 }, async () => {
const fromNumber = env.AZURE_PHONE_NUMBER as string;
const validToNumber = env.AZURE_PHONE_NUMBER as string;

const removeResults = await client.optOuts.remove(fromNumber, [validToNumber]);
assert.equal(200, removeResults[0].httpStatusCode);
assert.equal(removeResults[0].httpStatusCode, 200);

const checkResults = await client.optOuts.check(fromNumber, [validToNumber]);
assert.equal(200, checkResults[0].httpStatusCode);
assert.equal(false, checkResults[0].isOptedOut);
assert.equal(checkResults[0].httpStatusCode, 200);
assert.equal(checkResults[0].isOptedOut, false);
});
});
},
Expand Down

0 comments on commit 7642987

Please sign in to comment.