mirror of
https://github.com/Kong/insomnia.git
synced 2026-11-07 21:44:32 -05:00
36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
import { faker } from "@faker-js/faker";
|
|
import { expect } from "@playwright/test";
|
|
|
|
import { HttpMethod } from "../../enums/http-method";
|
|
import { ProjectType } from "../../enums/project-types";
|
|
import { HTTP_SERVER, test } from "../../misc/fixtures";
|
|
import { Collection } from "../../models/collection";
|
|
import { Project } from "../../models/project";
|
|
|
|
const url = `${HTTP_SERVER}/post`;
|
|
|
|
test("Verify Generate Code Produces A Matching cURL Snippet", async ({
|
|
user,
|
|
}) => {
|
|
const { httpRequestFlow, workspaceFlow } = user.flowManager;
|
|
|
|
const project = await workspaceFlow.createProject(
|
|
new Project(faker.string.alphanumeric(10), ProjectType.Local),
|
|
);
|
|
const collection = await workspaceFlow.createCollection(
|
|
project,
|
|
new Collection(faker.string.alphanumeric(10)),
|
|
);
|
|
const request = await httpRequestFlow.create(collection, {
|
|
name: faker.string.alphanumeric(10),
|
|
method: HttpMethod.Get,
|
|
url,
|
|
});
|
|
|
|
const code = await workspaceFlow.generateCode(request);
|
|
|
|
expect(code).toContain("curl");
|
|
expect(code).toContain("--request GET");
|
|
expect(code).toContain(url);
|
|
});
|