49 lines
1.3 KiB
TypeScript
49 lines
1.3 KiB
TypeScript
import {
|
|
CollectionSchemaVersion,
|
|
EnvironmentSchemaVersion,
|
|
getDefaultRESTRequest,
|
|
makeCollection,
|
|
} from '@hoppscotch/data';
|
|
|
|
export const sampleCollectionId = 'sample-echo';
|
|
|
|
export const createSampleCollection = (endpoint: string) =>
|
|
makeCollection({
|
|
id: sampleCollectionId,
|
|
name: 'Sample Echo',
|
|
folders: [],
|
|
requests: [
|
|
{
|
|
...getDefaultRESTRequest(),
|
|
id: 'sample-request-1',
|
|
name: 'GET echo',
|
|
endpoint,
|
|
method: 'GET',
|
|
testScript: `pw.test("Status code is 200", () => {
|
|
pw.expect(pw.response.status).toBe(200);
|
|
});`,
|
|
},
|
|
],
|
|
auth: { authType: 'inherit', authActive: true },
|
|
headers: [],
|
|
variables: [],
|
|
description: null,
|
|
preRequestScript: '',
|
|
testScript: '',
|
|
});
|
|
|
|
export const createSampleEnvironment = () => ({
|
|
v: EnvironmentSchemaVersion,
|
|
id: 'sample-env',
|
|
name: 'Sample',
|
|
variables: [
|
|
{
|
|
key: 'baseURL',
|
|
secret: false,
|
|
initialValue: 'http://127.0.0.1',
|
|
currentValue: 'http://127.0.0.1',
|
|
},
|
|
],
|
|
});
|
|
|
|
export const assertLatestCollectionVersion = CollectionSchemaVersion;
|