How to use postman-collection - 10 common examples

To help you get started, we’ve selected a few postman-collection 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 postmanlabs / postman-runtime / test / integration / bootstrap.js View on Github external
var runner = new Runner(_.merge({}, spec.options)),
        callbacks = {};

    // add a spy for each callback
    _.forEach(_.keys(Runner.Run.triggers), function (eventName) {
        callbacks[eventName] = sinon.spy();
    });

    // the final done callback needs special attention
    callbacks.done = sinon.spy(function () {
        done(null, callbacks, spec);
    });

    // eslint-disable-next-line handle-callback-err
    runner.run(new Collection(spec.collection), _.omit(spec, ['collection', 'options']), function (err, run) {
        run.start(callbacks);
    });
};
github DefinitelyTyped / DefinitelyTyped / types / postman-collection / postman-collection-tests.ts View on Github external
proxyConf.getProxyUrl(); // $ExpectType string

proxyConf.test("string"); // $ExpectType boolean

proxyConf.update(proxyConfDef); // $ExpectType void

proxyConf.updateProtocols(["string"]); // $ExpectType void

pmCollection.ProxyConfig.isProxyConfig(proxyConf); // $ExpectType boolean

// ProxyConfigList Tests

const proxyConfigList = new pmCollection.ProxyConfigList(null, [proxyConf]);

proxyConfigList.resolve("string"); // $ExpectType ProxyConfig
proxyConfigList.resolve(new pmCollection.Url({host: "string", path: "string"})); // $ExpectType ProxyConfig

pmCollection.ProxyConfigList.isProxyConfigList(proxyConfigList); // $ExpectType boolean

// QueryParamDefinition Tests

const qpDef: pmCollection.QueryParamDefinition = {
    key: null,
    value: null
};
qpDef.key; // $ExpectType string | null
qpDef.value; // $ExpectType string | null
qpDef.system; // $ExpectType boolean | undefined

// QueryParam Tests

let qp = new pmCollection.QueryParam("string");
github DefinitelyTyped / DefinitelyTyped / types / postman-collection / postman-collection-tests.ts View on Github external
item.getEvents(); // $ExpectType Event[]
item.getEvents("string"); // $ExpectType Event[]

pmCollection.Item.isItem(item); // $ExpectType boolean

// ProxyConfigDefinition Tests

const proxyConfDef: pmCollection.ProxyConfigDefinition = {};
proxyConfDef.match; // $ExpectType string | { pattern: string; } | UrlMatchPattern | undefined
proxyConfDef.host; // $ExpectType string | undefined
proxyConfDef.port; // $ExpectType number | undefined
proxyConfDef.tunnel; // $ExpectType boolean | undefined

// ProxyConfig Tests

let proxyConf = new pmCollection.ProxyConfig();
proxyConf = new pmCollection.ProxyConfig(proxyConfDef);

proxyConf.host; // $ExpectType string
proxyConf.match; // $ExpectType UrlMatchPattern
proxyConf.port; // $ExpectType number
proxyConf.tunnel; // $ExpectType boolean

proxyConf.getProtocols(); // $ExpectType string[]

proxyConf.getProxyUrl(); // $ExpectType string

proxyConf.test("string"); // $ExpectType boolean

proxyConf.update(proxyConfDef); // $ExpectType void

proxyConf.updateProtocols(["string"]); // $ExpectType void
github DefinitelyTyped / DefinitelyTyped / types / postman-collection / postman-collection-tests.ts View on Github external
item.getEvents("string"); // $ExpectType Event[]

pmCollection.Item.isItem(item); // $ExpectType boolean

// ProxyConfigDefinition Tests

const proxyConfDef: pmCollection.ProxyConfigDefinition = {};
proxyConfDef.match; // $ExpectType string | { pattern: string; } | UrlMatchPattern | undefined
proxyConfDef.host; // $ExpectType string | undefined
proxyConfDef.port; // $ExpectType number | undefined
proxyConfDef.tunnel; // $ExpectType boolean | undefined

// ProxyConfig Tests

let proxyConf = new pmCollection.ProxyConfig();
proxyConf = new pmCollection.ProxyConfig(proxyConfDef);

proxyConf.host; // $ExpectType string
proxyConf.match; // $ExpectType UrlMatchPattern
proxyConf.port; // $ExpectType number
proxyConf.tunnel; // $ExpectType boolean

proxyConf.getProtocols(); // $ExpectType string[]

proxyConf.getProxyUrl(); // $ExpectType string

proxyConf.test("string"); // $ExpectType boolean

proxyConf.update(proxyConfDef); // $ExpectType void

proxyConf.updateProtocols(["string"]); // $ExpectType void
github DefinitelyTyped / DefinitelyTyped / types / postman-collection / postman-collection-tests.ts View on Github external
vList.syncFromObject({}, false, false); // $ExpectType { created: string[]; updated: string[]; deleted: string[]; } | undefined

vList.syncToObject(); // $ExpectType { [key: string]: VariableDefinition; }
vList.syncToObject({key: varDef}); // $ExpectType { [key: string]: VariableDefinition; }

pmCollection.VariableList.isVariableList(vList); // $ExpectType boolean

// VariableScopeDefinition Tests
const varScopeDef: pmCollection.VariableScopeDefinition = {};
varScopeDef.values; // $ExpectType VariableDefinition[] | undefined

// VariableScope Tests
let varScope = new pmCollection.VariableScope(varScopeDef, []);
varScope = new pmCollection.VariableScope(vList, []);
varScope = new pmCollection.VariableScope([varDef], []);
varScope = new pmCollection.VariableScope(varScopeDef, [vList]);

varScope.values; // $ExpectType VariableDefinition[] | undefined

varScope.variables(); // ExpectType { [key: string]: VariableDefinition; }

varScope.toObject(false, false); // $ExpectType any

varScope.has("string"); // $ExpectType boolean

varScope.get("string"); // $ExpectType any

varScope.set("string", {}, "any"); // $ExpectType void

varScope.unset("string"); // $ExpectType void

varScope.clear(); // $ExpectType void
github DefinitelyTyped / DefinitelyTyped / types / postman-collection / postman-collection-tests.ts View on Github external
vList.syncFromObject({}); // $ExpectType { created: string[]; updated: string[]; deleted: string[]; } | undefined
vList.syncFromObject({}, false); // $ExpectType { created: string[]; updated: string[]; deleted: string[]; } | undefined
vList.syncFromObject({}, false, false); // $ExpectType { created: string[]; updated: string[]; deleted: string[]; } | undefined

vList.syncToObject(); // $ExpectType { [key: string]: VariableDefinition; }
vList.syncToObject({key: varDef}); // $ExpectType { [key: string]: VariableDefinition; }

pmCollection.VariableList.isVariableList(vList); // $ExpectType boolean

// VariableScopeDefinition Tests
const varScopeDef: pmCollection.VariableScopeDefinition = {};
varScopeDef.values; // $ExpectType VariableDefinition[] | undefined

// VariableScope Tests
let varScope = new pmCollection.VariableScope(varScopeDef, []);
varScope = new pmCollection.VariableScope(vList, []);
varScope = new pmCollection.VariableScope([varDef], []);
varScope = new pmCollection.VariableScope(varScopeDef, [vList]);

varScope.values; // $ExpectType VariableDefinition[] | undefined

varScope.variables(); // ExpectType { [key: string]: VariableDefinition; }

varScope.toObject(false, false); // $ExpectType any

varScope.has("string"); // $ExpectType boolean

varScope.get("string"); // $ExpectType any

varScope.set("string", {}, "any"); // $ExpectType void
github DefinitelyTyped / DefinitelyTyped / types / postman-collection / postman-collection-tests.ts View on Github external
ig.forEachItem((el) => {}); // $ExpectType void
ig.forEachItemGroup((el) => {}); // $ExpectType void

ig.oneDeep("string"); // $ExpectType Certificate

pmCollection.ItemGroup.isItemGroup(ig); // $ExpectType boolean

// CollectionDefinition Tests
const colDef: pmCollection.CollectionDefinition = {};
colDef.info; // $ExpectType { id?: string | undefined; name?: string | undefined; version?: string | undefined; } | undefined
colDef.variable; // $ExpectType VariableDefinition | undefined

let collection: pmCollection.Collection;
collection = new pmCollection.Collection();
collection = new pmCollection.Collection({});
collection = new pmCollection.Collection({}, []);

collection.events; // $ExpectType EventList
collection.variables; // $ExpectType VariableList
collection.version; // $ExpectType Version | undefined

collection.syncVariablesFrom({}); // $ExpectType { created: string[]; updated: string[]; deleted: string[]; } | undefined
collection.syncVariablesFrom({}, true); // $ExpectType { created: string[]; updated: string[]; deleted: string[]; } | undefined

collection.syncVariablesTo({}); // ExpectType $ExpectType { [key: string]: VariableDefinition; }

collection.toJSON(); // $ExpectType CollectionDefinition

pmCollection.Collection.isCollection(collection); // $ExpectType boolean

// CookieDefinition Tests
github DefinitelyTyped / DefinitelyTyped / types / postman-collection / postman-collection-tests.ts View on Github external
ig.forEachItem((el) => {}); // $ExpectType void
ig.forEachItemGroup((el) => {}); // $ExpectType void

ig.oneDeep("string"); // $ExpectType Certificate

pmCollection.ItemGroup.isItemGroup(ig); // $ExpectType boolean

// CollectionDefinition Tests
const colDef: pmCollection.CollectionDefinition = {};
colDef.info; // $ExpectType { id?: string | undefined; name?: string | undefined; version?: string | undefined; } | undefined
colDef.variable; // $ExpectType VariableDefinition | undefined

let collection: pmCollection.Collection;
collection = new pmCollection.Collection();
collection = new pmCollection.Collection({});
collection = new pmCollection.Collection({}, []);

collection.events; // $ExpectType EventList
collection.variables; // $ExpectType VariableList
collection.version; // $ExpectType Version | undefined

collection.syncVariablesFrom({}); // $ExpectType { created: string[]; updated: string[]; deleted: string[]; } | undefined
collection.syncVariablesFrom({}, true); // $ExpectType { created: string[]; updated: string[]; deleted: string[]; } | undefined

collection.syncVariablesTo({}); // ExpectType $ExpectType { [key: string]: VariableDefinition; }

collection.toJSON(); // $ExpectType CollectionDefinition

pmCollection.Collection.isCollection(collection); // $ExpectType boolean

// CookieDefinition Tests
const cookieDef: pmCollection.CookieDefinition = {
github DefinitelyTyped / DefinitelyTyped / types / postman-collection / postman-collection-tests.ts View on Github external
host: ["string"],
    path: ["string"]
};

urlDef.auth; // $ExpectType { user: string; password: string; } | undefined
urlDef.hash; // $ExpectType string | undefined
urlDef.host; // $ExpectType string | string[] | undefined
urlDef.path; // $ExpectType string | string[]
urlDef.port; // $ExpectType string | undefined
urlDef.query; // $ExpectType string | QueryParamDefinition[] | PropertyList | undefined
urlDef.variable; // $ExpectType VariableDefinition[] | undefined
urlDef.protocol; // $ExpectType string | undefined

// Url Tests

let url = new pmCollection.Url(urlDef);
url = new pmCollection.Url("string");

url.auth; // $ExpectType { user: string; password: string; } | undefined
url.hash; // $ExpectType string | undefined
url.host; // $ExpectType string[] | undefined
url.path; // $ExpectType string[]
url.port; // $ExpectType string | undefined
url.protocol; // $ExpectType string | undefined
url.query; // $ExpectType PropertyList
url.variables; // $ExpectType VariableList

url.addQueryParams("string"); // $ExpectType void
url.addQueryParams([qp, qpDef]); // $ExpectType void

url.removeQueryParams("string"); // $ExpectType void
url.removeQueryParams(["string"]); // $ExpectType void
github DefinitelyTyped / DefinitelyTyped / types / postman-collection / postman-collection-tests.ts View on Github external
// CertificateDefinition Tests
const certDef: pmCollection.CertificateDefinition = {};
certDef.matches; // $ExpectType string[] | UrlMatchPatternList | undefined
certDef.key; // $ExpectType string | { src?: string | undefined; } | undefined
certDef.cert; // $ExpectType string | { src?: string | undefined; } | undefined
certDef.passphrase; // $ExpectType string | undefined

// Certificate Tests
const certificate = new pmCollection.Certificate({});
certificate.cert; // $ExpectType { src?: string | undefined; }
certificate.key; // $ExpectType { src?: string | undefined; }
certificate.matches; // $ExpectType UrlMatchPatternList
certificate.passphrase; // $ExpectType string

certificate.canApplyTo("string"); // $ExpectType boolean
certificate.canApplyTo(new pmCollection.Url({host: "string", path: "string"})); // $ExpectType boolean

certificate.update({}); // $ExpectType void

pmCollection.Certificate.isCertificate(certificate); // $ExpectType boolean

// PropertyList Tests
const pList = new pmCollection.PropertyList("Certificate", null, []);
pList.add(certificate); // $ExpectType void
pList.all(); // $ExpectType Certificate[]
pList.append(certificate); // $ExpectType void
pList.assimilate(pList, false); // $ExpectType void
pList.assimilate([certificate], false); // ExpectType void
pList.clear(); // $ExpectType void
pList.count(); // $ExpectType number
pList.each((el: pmCollection.Certificate) => {}); // $ExpectType void
pList.each((el: pmCollection.Certificate) => {}, pList); // $ExpectType void