Skip to content

Commit 8b1b874

Browse files
committed
refactor(stack): rename searchStack route
The name was confusing as to what it searches. Hence, we renamed it to search instead of searchStack.
1 parent 4746a54 commit 8b1b874

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

__test__/stack.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,30 +109,30 @@ describe("Stack", () => {
109109
});
110110
});
111111

112-
it("searchStack", (done) => {
112+
it("search", (done) => {
113113
const query: StackSearchQuery = { type: "entries" };
114-
stack.searchStack(query).then(() => {
114+
stack.search(query).then(() => {
115115
expect(connection.sendToParent).toHaveBeenCalledWith(
116116
"stackQuery",
117117
{
118118
api_key: getStack().api_key,
119-
action: "searchStack",
119+
action: "search",
120120
params: query,
121121
}
122122
);
123123
done();
124124
});
125125
});
126126

127-
it("searchStack should make query to other stack if api key is provided", (done) => {
127+
it("search should make query to other stack if api key is provided", (done) => {
128128
const query: StackSearchQuery = { type: "entries" };
129129
const apiKey = "sample_api_key";
130-
stack.searchStack(query, apiKey).then(() => {
130+
stack.search(query, apiKey).then(() => {
131131
expect(connection.sendToParent).toHaveBeenCalledWith(
132132
"stackQuery",
133133
{
134134
api_key: apiKey,
135-
action: "searchStack",
135+
action: "search",
136136
params: query,
137137
}
138138
);

src/stack/index.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ class Stack {
5656

5757
/**
5858
* This method returns the data of the current stack.
59-
* @return {Object} Returns stack data.
59+
* @return Returns stack data.
6060
*/
6161

62-
getData() {
62+
getData(): StackDetail {
6363
return this._data;
6464
}
6565

@@ -70,8 +70,6 @@ class Stack {
7070
* @returns Stacks within current organization
7171
*/
7272
async getAllStacks({orgUid = "", params = {}}: GetAllStacksOptions = {}): Promise<StackDetail[]> {
73-
74-
console.log("getAllStacks", orgUid, typeof orgUid);
7573

7674
// validation
7775
if (typeof orgUid !== 'string') {
@@ -98,8 +96,8 @@ class Stack {
9896
* @param apiKey API key of the stack
9997
* @returns Result of the query
10098
*/
101-
searchStack(queries: StackSearchQuery, apiKey = this._data.api_key) {
102-
const options = { params: queries, api_key: apiKey, action: "searchStack" };
99+
search(queries: StackSearchQuery, apiKey: string | null = this._data.api_key) {
100+
const options = { params: queries, api_key: apiKey, action: "search" };
103101
return this._connection
104102
.sendToParent("stackQuery", options)
105103
.then(onData)

0 commit comments

Comments
 (0)