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

fix(Git): issue with including unit-tests and protofiles #8095

Merged
merged 2 commits into from
Oct 17, 2024
Merged
Changes from all commits
Commits
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
23 changes: 22 additions & 1 deletion packages/insomnia/src/sync/git/ne-db-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,29 @@ export class NeDBClient {
];
} else if (type !== null && id === null) {
const workspace = await db.get(models.workspace.type, this._workspaceId);
let typeFilter = [type];

const modelTypesWithinFolders = [models.request.type, models.grpcRequest.type, models.webSocketRequest.type];
const typeFilter = modelTypesWithinFolders.includes(type) ? [models.requestGroup.type, type] : [type];
if (modelTypesWithinFolders.includes(type)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want to get all requests in a workspace, It's unintuitive that we need to pass [requestGroup, request] as the queryTypes argument to withDescendants and then filter out the requestGroups from result. Maybe we can do it within withDescendants method.

typeFilter = [models.requestGroup.type, type];
};

if (type === models.unitTest.type) {
typeFilter = [models.unitTestSuite.type, type];
}

if (type === models.protoFile.type) {
typeFilter = [models.protoDirectory.type, type];
}

if (type === models.mockRoute.type) {
typeFilter = [models.mockServer.type, type];
}

if (type === models.webSocketPayload.type) {
typeFilter = [models.webSocketRequest.type, type];
}

const children = await db.withDescendants(workspace, null, typeFilter);
docs = children.filter(d => d.type === type && !d.isPrivate);
} else {
Expand Down
Loading