Add Azure Function Service Error/Cancel tests (#19758)

* cleanup tests

* exit/error scenario tests

* remove + from manuallyEnterObjectName

* address comments

* add resolve for writeFile
This commit is contained in:
Vasu Bhog
2022-06-20 15:48:38 -07:00
committed by GitHub
parent 0aadd317fa
commit c5093dbb5a
8 changed files with 151 additions and 39 deletions

View File

@@ -44,7 +44,7 @@ describe('AzureFunctionUtils', function (): void {
"Values": {"test1": "test1", "test2": "test2", "test3":"test3"}}`
);
let writeFileStub = sinon.stub(fs.promises, 'writeFile');
let writeFileStub = sinon.stub(fs.promises, 'writeFile').resolves();
await azureFunctionsUtils.setLocalAppSetting(path.dirname(localSettingsPath), 'test4', 'test4');
should(writeFileStub.calledWithExactly(localSettingsPath, `{\n "IsEncrypted": false,\n "Values": {\n "test1": "test1",\n "test2": "test2",\n "test3": "test3",\n "test4": "test4"\n }\n}`)).equals(true, 'writeFile should be called with the correct arguments');
});
@@ -77,7 +77,7 @@ describe('AzureFunctionUtils', function (): void {
);
const connectionString = 'testConnectionString';
let writeFileStub = sinon.stub(fs.promises, 'writeFile');
let writeFileStub = sinon.stub(fs.promises, 'writeFile').resolves();
await azureFunctionsUtils.addConnectionStringToConfig(connectionString, rootFolderPath);
should(writeFileStub.calledWithExactly(localSettingsPath, `{\n "IsEncrypted": false,\n "Values": {\n "test1": "test1",\n "test2": "test2",\n "test3": "test3",\n "SqlConnectionString": "testConnectionString"\n }\n}`)).equals(true, 'writeFile should be called with the correct arguments');
});