Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(vscode): Developing Cloud to Local feature #5046

Merged
merged 18 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
49a2450
Add Cloud to Local Gesture
Jaden-Codes May 22, 2024
194d6c9
Add Cloud to Local Gesture
Jaden-Codes May 22, 2024
85c6958
Merge branch 'main' into AddCloudtoLocalGesture
Jaden-Codes May 23, 2024
7f4c6eb
feat: Add cloud to local gesture
Jaden-Codes May 23, 2024
77ceaf1
feat(vscode/design/Cloud to Local): Added a button for cloud to local…
Jaden-Codes May 23, 2024
eea0f0f
feat(vscode): Add button to take zipped Logic App from the desktop an…
Jaden-Codes Jun 4, 2024
e7c0ba5
fix(vscode): fixed naming of menu item
Jaden-Codes Jun 4, 2024
795fcb3
fix(vscode): Changed to single function call
Jaden-Codes Jun 5, 2024
8e96050
feat(vscode): Made merging of local.settings.json
Jaden-Codes Jun 12, 2024
3569f32
fix(vscode): Changed bundle and script settings to prioritize LA
Jaden-Codes Jun 17, 2024
3746a89
fix(vscode): Branch is messed up, trying to fix
Jaden-Codes Jun 28, 2024
2be32f5
Merge branch 'AddCloudtoLocalGesture' of https://github.com/Jaden-Cod…
Jaden-Codes Jun 28, 2024
361882e
feat(vscode): parameters changed to raw/key and organized cloudToLocal
Jaden-Codes Jul 3, 2024
adfaf39
Merge branch 'dev/cloud' into AddCloudtoLocalGesture
Jaden-Codes Jul 3, 2024
1f3b7ac
fix(vscode): Remove duplicate deepMerge function
Jaden-Codes Jul 3, 2024
4fea571
fix(vscode): added tests, changed connections to work with cloudtoloc…
Jaden-Codes Jul 18, 2024
941b0b5
fix(vscode): changed the deepmerge into extend because there are test…
Jaden-Codes Jul 18, 2024
353b989
fix(vscode): removed static tenant Id, used parameterFileName import,…
Jaden-Codes Jul 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"recommendations": [
"biomejs.biome",
"dbaeumer.vscode-eslint"
"dbaeumer.vscode-eslint",
"ms-vscode.azure-account"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import { extractConnectionDetails, changeAuthTypeToRaw } from '../cloudToLocalHelper';
import type { ConnectionReferenceModel } from '@microsoft/vscode-extension-logic-apps';
import { describe, it, expect, vi } from 'vitest';
import { beforeEach } from 'vitest';

vi.mock('fs');
describe('extractConnectionDetails and ChangAuthToRaw are being tested for cloudToLocal.', () => {
beforeEach(() => {
vi.clearAllMocks();
});

describe('extractConnectionDetails for ConnectionReferenceModel', () => {
it('should extract connection details correctly', () => {
let connectionObject = {
managedApiConnections: {
connKey: {
api: {
id: '/subscriptions/346751b2-0de1-405c-ad29-acb7ba73797f/providers/Microsoft.Web/locations/eastus2/managedApis/applicationinsights',
},
connection: {
id: '/subscriptions/346751b2-0de1-405c-ad29-acb7ba73797f/resourceGroups/vs-code-debug/providers/Microsoft.Web/connections/applicationinsights',
},
authentication: {
type: 'ManagedServiceIdentity',
},
connectionRuntimeUrl: 'runtime-url',
},
},
};
const newconnection = JSON.stringify(connectionObject);
const parsedconnection: ConnectionReferenceModel = JSON.parse(newconnection);

const details = extractConnectionDetails(parsedconnection);

const expectedDetails = [
{
WORKFLOWS_LOCATION_NAME: 'eastus2',
WORKFLOWS_RESOURCE_GROUP_NAME: 'vs-code-debug',
WORKFLOWS_SUBSCRIPTION_ID: '346751b2-0de1-405c-ad29-acb7ba73797f',
},
];

expect(details).toEqual(expectedDetails);
});
});

describe('ChangeAuthToRaw for ConnectionReferenceModel', () => {
it('should change authentication type to Raw', () => {
// Setup
let connectionsJsonContent = {
managedApiConnections: {
applicationinsights: {
api: {
id: '/subscriptions/346751b2-0de1-405c-ad29-acb7ba73797f/providers/Microsoft.Web/locations/eastus2/managedApis/applicationinsights',
},
connection: {
id: '/subscriptions/346751b2-0de1-405c-ad29-acb7ba73797f/resourceGroups/vs-code-debug/providers/Microsoft.Web/connections/applicationinsights',
},
authentication: {
type: 'ManagedServiceIdentity',
},
},
},
};
const jsonString = JSON.stringify(connectionsJsonContent);
const connection: ConnectionReferenceModel = JSON.parse(jsonString);

changeAuthTypeToRaw(connection);

const expectedConnection = JSON.stringify({
managedApiConnections: {
applicationinsights: {
api: {
id: '/subscriptions/346751b2-0de1-405c-ad29-acb7ba73797f/providers/Microsoft.Web/locations/eastus2/managedApis/applicationinsights',
},
connection: {
id: '/subscriptions/346751b2-0de1-405c-ad29-acb7ba73797f/resourceGroups/vs-code-debug/providers/Microsoft.Web/connections/applicationinsights',
},
authentication: {
type: 'Raw',
scheme: 'Key',
parameter: "@appsetting('applicationinsights-connectionKey')",
},
},
},
});
expect(JSON.stringify(connection)).toEqual(expectedConnection);
});
});
});
Loading
Loading