diff --git a/nodejs-p-limit.spec b/nodejs-p-limit.spec index 33a257c..a17f944 100644 --- a/nodejs-p-limit.spec +++ b/nodejs-p-limit.spec @@ -7,8 +7,7 @@ Release: 1 Summary: Run multiple promise-returning & async functions with limited concurrency License: MIT URL: https://github.com/sindresorhus/p-limit -Source0: https://registry.npmjs.org/%{packagename}/-/%{packagename}-%{version}.tgz -Source1: https://raw.githubusercontent.com/sindresorhus/p-limit/v%{version}/test.js +Source0: https://github.com/sindresorhus/p-limit/archive/v%{version}.tar.gz ExclusiveArch: %{nodejs_arches} noarch BuildArch: noarch BuildRequires: nodejs-packaging @@ -19,8 +18,7 @@ BuildRequires: npm(ava) Run multiple promise-returning & async functions with limited concurrency %prep -%autosetup -n package -cp -p %{SOURCE1} . +%autosetup -n p-limit-%{version} %build diff --git a/p-limit-1.1.0.tgz b/p-limit-1.1.0.tgz deleted file mode 100644 index 6fd05ac..0000000 Binary files a/p-limit-1.1.0.tgz and /dev/null differ diff --git a/test.js b/test.js deleted file mode 100644 index 79582a5..0000000 --- a/test.js +++ /dev/null @@ -1,37 +0,0 @@ -import test from 'ava'; -import delay from 'delay'; -import inRange from 'in-range'; -import timeSpan from 'time-span'; -import randomInt from 'random-int'; -import m from './'; - -test('concurrency: 1', async t => { - const input = [ - [10, 300], - [20, 200], - [30, 100] - ]; - - const end = timeSpan(); - const limit = m(1); - const mapper = ([val, ms]) => limit(() => delay(ms).then(() => val)); - - t.deepEqual(await Promise.all(input.map(mapper)), [10, 20, 30]); - t.true(inRange(end(), 590, 650)); -}); - -test('concurrency: 4', async t => { - const concurrency = 5; - let running = 0; - - const limit = m(concurrency); - - const input = Array(100).fill(0).map(() => limit(async () => { - running++; - t.true(running <= concurrency); - await delay(randomInt(30, 200)); - running--; - })); - - await Promise.all(input); -}); diff --git a/v1.1.0.tar.gz b/v1.1.0.tar.gz new file mode 100644 index 0000000..083f232 Binary files /dev/null and b/v1.1.0.tar.gz differ