Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
test('global', async t => {
const [ main ] = await convertFile('test/material/2/var-global.json', {
globals: 'test/material/2/globals.json'
})
t.is(main, `// Auto-generated by the Load Impact converter
import "./libs/shim/core.js";
export let options = { maxRedirects: 4 };
const Request = Symbol.for("request");
postman[Symbol.for("initial")]({
options,
global: {
first: "one",
second: "two",
third: "three"
}
test('pre folder', async t => {
const [ main ] = await convertFile('test/material/2/pre-folder.json')
t.is(main, `// Auto-generated by the Load Impact converter
import "./libs/shim/core.js";
import { group } from "k6";
export let options = { maxRedirects: 4 };
const Pre = Symbol.for("pre");
const Request = Symbol.for("request");
postman[Symbol.for("initial")]({
options
});
export default function() {
group("TestFolder", function() {
postman[Pre].push(() => {
test('pre collection', async t => {
const [ main ] = await convertFile('test/material/2/pre-collection.json')
t.is(main, `// Auto-generated by the Load Impact converter
import "./libs/shim/core.js";
export let options = { maxRedirects: 4 };
const Pre = Symbol.for("pre");
const Request = Symbol.for("request");
postman[Symbol.for("initial")]({
options
});
export default function() {
postman[Pre].push(() => {
pm.variables.set("test", "a");
pm.variables.set("test2", "b");
test('raw body', async t => {
const [ main ] = await convertFile('test/material/2/body-raw.json')
t.is(main, `// Auto-generated by the Load Impact converter
import "./libs/shim/core.js";
export let options = { maxRedirects: 4 };
const Request = Symbol.for("request");
postman[Symbol.for("initial")]({
options
});
export default function() {
postman[Request]({
name: "TestRequest",
method: "POST",
address: "http://example.com",
test('data csv', async t => {
const [ main ] = await convertFile('test/material/2/var-data-csv.json', {
csv: 'test/material/2/data-csv.csv'
})
t.is(main, `// Auto-generated by the Load Impact converter
import "./libs/shim/core.js";
import papaparse from "./libs/papaparse.js";
export let options = { maxRedirects: 4 };
const file = (() => {
// Load data file
const text = open("./data.csv");
const rows = papaparse.parse(text, { header: true }).data;
return rows;
})();
options.iterations = file.length;
test('post collection', async t => {
const [ main ] = await convertFile('test/material/2/post-collection.json')
t.is(main, `// Auto-generated by the Load Impact converter
import "./libs/shim/core.js";
export let options = { maxRedirects: 4 };
const Post = Symbol.for("post");
const Request = Symbol.for("request");
postman[Symbol.for("initial")]({
options
});
export default function() {
postman[Post].push(() => {
pm.variables.set("test", "a");
pm.variables.set("test", "b");
test('post folder', async t => {
const [ main ] = await convertFile('test/material/2/post-folder.json')
t.is(main, `// Auto-generated by the Load Impact converter
import "./libs/shim/core.js";
import { group } from "k6";
export let options = { maxRedirects: 4 };
const Post = Symbol.for("post");
const Request = Symbol.for("request");
postman[Symbol.for("initial")]({
options
});
export default function() {
group("TestFolder", function() {
postman[Post].push(() => {
test('post nested', async t => {
const [ main ] = await convertFile('test/material/2/post-nested.json')
t.is(main, `// Auto-generated by the Load Impact converter
import "./libs/shim/core.js";
import { group } from "k6";
export let options = { maxRedirects: 4 };
const Post = Symbol.for("post");
const Request = Symbol.for("request");
postman[Symbol.for("initial")]({
options
});
export default function() {
group("TestFolder", function() {
postman[Post].push(() => {
test('inherit nested', async t => {
const [ main ] = await convertFile('test/material/2/inherit-nested.json')
t.is(main, `// Auto-generated by the Load Impact converter
import "./libs/shim/core.js";
import { group } from "k6";
export let options = { maxRedirects: 4 };
const Request = Symbol.for("request");
postman[Symbol.for("initial")]({
options
});
export default function() {
group("TestFolder1", function() {
group("TestFolder2", function() {
group("TestFolder3", function() {
test('bearer', async t => {
const [ main ] = await convertFile('test/material/2/bearer.json')
t.is(main, `// Auto-generated by the Load Impact converter
import "./libs/shim/core.js";
export let options = { maxRedirects: 4 };
const Request = Symbol.for("request");
postman[Symbol.for("initial")]({
options
});
export default function() {
postman[Request]({
name: "TestRequest",
method: "GET",
address: "http://example.com",