How to use the convert/file function in convert

To help you get started, we’ve selected a few convert examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github loadimpact / postman-to-k6 / test / int / var.js View on Github external
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"
  }
github loadimpact / postman-to-k6 / test / int / script.js View on Github external
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(() => {
github loadimpact / postman-to-k6 / test / int / script.js View on Github external
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");
github loadimpact / postman-to-k6 / test / int / basic.js View on Github external
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",
github loadimpact / postman-to-k6 / test / int / var.js View on Github external
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;
github loadimpact / postman-to-k6 / test / int / script.js View on Github external
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");
github loadimpact / postman-to-k6 / test / int / script.js View on Github external
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(() => {
github loadimpact / postman-to-k6 / test / int / script.js View on Github external
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(() => {
github loadimpact / postman-to-k6 / test / int / auth.js View on Github external
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() {
github loadimpact / postman-to-k6 / test / int / auth.js View on Github external
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",

convert

The smallest & fastest library for really easy, totally type-safe unit conversions in TypeScript & JavaScript

MIT
Latest version published 10 days ago

Package Health Score

80 / 100
Full package analysis