UNPKG

@apollo/client

Version:

A fully-featured caching GraphQL client.

1 lines • 1.5 kB
{"version":3,"file":"itAsync.js","sourceRoot":"","sources":["../../../src/testing/core/itAsync.ts"],"names":[],"mappings":"AAAA,SAAS,IAAI,CAAU,GAA8B;IACnD,OAAO,UACL,OAAe,EACf,QAGQ,EACR,OAAgB,IACb,OAAA,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE;QAAA,iBAIlC;QAHC,OAAO,IAAI,OAAO,CAChB,UAAC,OAAO,EAAE,MAAM,IAAK,OAAA,QAAQ,CAAC,IAAI,CAAC,KAAI,EAAE,OAAO,EAAE,MAAM,CAAC,EAApC,CAAoC,CAC1D,CAAC;IACJ,CAAC,EAAE,OAAO,CAAC,EAJN,CAIM,CAAC;AACd,CAAC;AAED,IAAM,SAAS,GAAG,IAAI,EAAE,CAAC;AAEzB,MAAM,CAAC,IAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC;IACnC,cAAqC;SAArC,UAAqC,EAArC,qBAAqC,EAArC,IAAqC;QAArC,yBAAqC;;IAErC,OAAO,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACrC,CAAC,EAAE;IACD,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;IAClB,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;IAClB,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;CACnB,CAAC,CAAC","sourcesContent":["function wrap<TResult>(key?: \"only\" | \"skip\" | \"todo\") {\n return (\n message: string,\n callback: (\n resolve: (result?: any) => void,\n reject: (reason?: any) => void,\n ) => any,\n timeout?: number,\n ) => (key ? it[key] : it)(message, function () {\n return new Promise(\n (resolve, reject) => callback.call(this, resolve, reject),\n );\n }, timeout);\n}\n\nconst wrappedIt = wrap();\n\nexport const itAsync = Object.assign(function (\n ...args: Parameters<typeof wrappedIt>\n) {\n return wrappedIt.apply(this, args);\n}, {\n only: wrap(\"only\"),\n skip: wrap(\"skip\"),\n todo: wrap(\"todo\"),\n});\n"]}