-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: git auto generate header issue fixed
- Loading branch information
“sneha122”
committed
Apr 29, 2024
1 parent
0d03411
commit 769749d
Showing
3 changed files
with
54 additions
and
0 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
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,52 @@ | ||
import type { CreateApiActionDefaultsParams } from "entities/Action"; | ||
import { createDefaultApiActionPayload } from "sagas/ApiPaneSagas"; | ||
|
||
describe("tests the sagas in ApiPaneSagas", () => { | ||
const inputPayload: CreateApiActionDefaultsParams = { | ||
apiType: "graphql-plugin", | ||
newActionName: "newName", | ||
}; | ||
|
||
it("1. Bug 27941: Tests createDefaultApiActionPayload to return prepopulated empty array for autoGeneratedHeaders", function () { | ||
const outputPayloadGenerator: Generator = | ||
createDefaultApiActionPayload(inputPayload); | ||
|
||
// Mocking getCurrentWorkspaceId selector | ||
const workspaceIdSelectorEffect = outputPayloadGenerator.next().value; | ||
workspaceIdSelectorEffect.payload.selector = jest.fn(); | ||
workspaceIdSelectorEffect.payload.selector.mockReturnValue( | ||
"testWorkspaceId", | ||
); | ||
|
||
// Mock getPluginIdOfPackageName selector | ||
const pluginIdSelectorEffect = outputPayloadGenerator.next().value; | ||
pluginIdSelectorEffect.payload.selector = jest.fn(); | ||
pluginIdSelectorEffect.payload.selector.mockReturnValue("pluginId"); | ||
|
||
// Get actionconfig value now | ||
const outputPayload = outputPayloadGenerator.next().value; | ||
expect(outputPayload?.actionConfiguration.autoGeneratedHeaders).toEqual([]); | ||
}); | ||
|
||
it("2. Bug 27941: Tests createDefaultApiActionPayload to return prepopulated empty array for autoGeneratedHeaders", function () { | ||
inputPayload.apiType = "restapi-plugin"; | ||
const outputPayloadGenerator: Generator = | ||
createDefaultApiActionPayload(inputPayload); | ||
|
||
// Mocking getCurrentWorkspaceId selector | ||
const workspaceIdSelectorEffect = outputPayloadGenerator.next().value; | ||
workspaceIdSelectorEffect.payload.selector = jest.fn(); | ||
workspaceIdSelectorEffect.payload.selector.mockReturnValue( | ||
"testWorkspaceId", | ||
); | ||
|
||
// Mock getPluginIdOfPackageName selector | ||
const pluginIdSelectorEffect = outputPayloadGenerator.next().value; | ||
pluginIdSelectorEffect.payload.selector = jest.fn(); | ||
pluginIdSelectorEffect.payload.selector.mockReturnValue("pluginId"); | ||
|
||
// Get actionconfig value now | ||
const outputPayload = outputPayloadGenerator.next().value; | ||
expect(outputPayload?.actionConfiguration.autoGeneratedHeaders).toEqual([]); | ||
}); | ||
}); |