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

Extend api list with two apis #2108

Merged
merged 1 commit into from
Feb 20, 2023
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion tests/e2e/runtime/apis.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ describe("Apis page", async () => {

it("User can see apis on the page", async () => {
var apis = new Apis();
apis.addApi(Api.getEchoApi());
apis.addApi(Api.getRandomApi());
apis.addApi(Api.getRandomApi());
server = await Utils.createMockServer([apis.getApisListResponse()]);

const page = await browser.newPage();
Expand Down
6 changes: 6 additions & 0 deletions tests/mocks/collection/api.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Utils } from "../../utils";

export class Api{
public apiId: string;
public apiName: string;
Expand Down Expand Up @@ -49,4 +51,8 @@ export class Api{
public static getEchoApi(){
return new Api("echo-api", "Echo api");
}

public static getRandomApi(){
return new Api(Utils.randomIdentifier(), Utils.randomIdentifier());
}
}
12 changes: 12 additions & 0 deletions tests/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ export class Utils {
return sasToken;
}

public static randomIdentifier(length: number = 8): string {
let result = "";
const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
const charactersLength = characters.length;

for (let i = 0; i < length; i++) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}

return result;
}

public static async createMockServer(responses?: Object[]) {
var obj = {};
if (responses?.length){
Expand Down