Skip to content

Commit

Permalink
chore(deps): bump to latest major tough-cookie; real URLs in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gadicc committed Feb 15, 2025
1 parent 2aa7e51 commit bce370e
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 15 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@
"schema.json"
],
"dependencies": {
"@types/tough-cookie": "^4.0.2",
"tough-cookie": "^4.1.2",
"tough-cookie": "^5.1.1",
"tough-cookie-file-store": "^2.0.3"
},
"devDependencies": {
Expand Down
18 changes: 11 additions & 7 deletions src/lib/yahooFinanceFetch.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,11 @@ describe("yahooFinanceFetch", () => {
});

it("yahooFinanceFetch branch check for alternate queue", async () => {
const url = "http://example.com";
const promises = [
yahooFinanceFetch("", {}),
yahooFinanceFetch("", {}, {}),
yahooFinanceFetch("", {}, { queue: {} }),
yahooFinanceFetch(url, {}),
yahooFinanceFetch(url, {}, {}),
yahooFinanceFetch(url, {}, { queue: {} }),
];

await immediate();
Expand All @@ -136,33 +137,36 @@ describe("yahooFinanceFetch", () => {
});

it("assert defualts to {} for empty queue opts", async () => {
const url = "http://example.com";
moduleOpts.queue.concurrency = 1;
const opts = { ..._opts };
// @ts-ignore: intentional to test runtime failures
delete opts.queue;
const yahooFinanceFetch = _yahooFinanceFetch.bind({ _env: env, _opts });

const promise = yahooFinanceFetch("", {}, moduleOpts);
const promise = yahooFinanceFetch(url, {}, moduleOpts);
await immediate();
env.fetch.fetches[0].resolveWith({ ok: true });
await expect(promise).resolves.toMatchObject({ ok: true });
});

it("single item in queue", async () => {
const url = "http://example.com";
moduleOpts.queue.concurrency = 1;

const promise = yahooFinanceFetch("", {}, moduleOpts);
const promise = yahooFinanceFetch(url, {}, moduleOpts);
await immediate();
env.fetch.fetches[0].resolveWith({ ok: true });
await expect(promise).resolves.toMatchObject({ ok: true });
});

it("waits if exceeding concurrency max", async () => {
const url = "http://example.com";
moduleOpts.queue.concurrency = 1;

const promises = [
yahooFinanceFetch("", {}, moduleOpts),
yahooFinanceFetch("", {}, moduleOpts),
yahooFinanceFetch(url, {}, moduleOpts),
yahooFinanceFetch(url, {}, moduleOpts),
];
await immediate();

Expand Down
26 changes: 20 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1915,11 +1915,6 @@
resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.0.tgz#7036640b4e21cc2f259ae826ce843d277dad8cff"
integrity sha512-RJJrrySY7A8havqpGObOB4W92QXKJo63/jFLLgpvOtsGUqbQZ9Sbgl35KMm1DjC6j7AvmmU2bIno+3IyEaemaw==

"@types/tough-cookie@^4.0.2":
version "4.0.5"
resolved "https://registry.yarnpkg.com/@types/tough-cookie/-/tough-cookie-4.0.5.tgz#cb6e2a691b70cb177c6e3ae9c1d2e8b2ea8cd304"
integrity sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==

"@types/yargs-parser@*":
version "21.0.3"
resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-21.0.3.tgz#815e30b786d2e8f0dcd85fd5bcf5e1a04d008f15"
Expand Down Expand Up @@ -6490,6 +6485,18 @@ tiny-relative-date@^1.3.0:
resolved "https://registry.yarnpkg.com/tiny-relative-date/-/tiny-relative-date-1.3.0.tgz#fa08aad501ed730f31cc043181d995c39a935e07"
integrity sha512-MOQHpzllWxDCHHaDno30hhLfbouoYlOI8YlMNtvKe1zXbjEVhbcEovQxvZrPvtiYW630GQDoMMarCnjfyfHA+A==

tldts-core@^6.1.77:
version "6.1.77"
resolved "https://registry.yarnpkg.com/tldts-core/-/tldts-core-6.1.77.tgz#0fa4563163a7a61d72c4b05650fb66fc7e815500"
integrity sha512-bCaqm24FPk8OgBkM0u/SrEWJgHnhBWYqeBo6yUmcZJDCHt/IfyWBb+14CXdGi4RInMv4v7eUAin15W0DoA+Ytg==

tldts@^6.1.32:
version "6.1.77"
resolved "https://registry.yarnpkg.com/tldts/-/tldts-6.1.77.tgz#714e3d1989e562886f2ed97b65e95a8e9f9e92d9"
integrity sha512-lBpoWgy+kYmuXWQ83+R7LlJCnsd9YW8DGpZSHhrMl4b8Ly/1vzOie3OdtmUJDkKxcgRGOehDu5btKkty+JEe+g==
dependencies:
tldts-core "^6.1.77"

tmpl@1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.5.tgz#8683e0b902bb9c20c4f726e3c0b69f36518c07cc"
Expand All @@ -6514,7 +6521,7 @@ tough-cookie-file-store@^2.0.3:
dependencies:
tough-cookie "^4.0.0"

tough-cookie@^4.0.0, tough-cookie@^4.1.2:
tough-cookie@^4.0.0:
version "4.1.4"
resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-4.1.4.tgz#945f1461b45b5a8c76821c33ea49c3ac192c1b36"
integrity sha512-Loo5UUvLD9ScZ6jh8beX1T6sO1w2/MpCRpEP7V280GKMVUQ0Jzar2U3UJPsrdbziLEMMhu3Ujnq//rhiFuIeag==
Expand All @@ -6524,6 +6531,13 @@ tough-cookie@^4.0.0, tough-cookie@^4.1.2:
universalify "^0.2.0"
url-parse "^1.5.3"

tough-cookie@^5.1.1:
version "5.1.1"
resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-5.1.1.tgz#4641c1fdbf024927e29c5532edb7b6e5377ea1f2"
integrity sha512-Ek7HndSVkp10hmHP9V4qZO1u+pn1RU5sI0Fw+jCU3lyvuMZcgqsNgc6CmJJZyByK4Vm/qotGRJlfgAX8q+4JiA==
dependencies:
tldts "^6.1.32"

tr46@~0.0.3:
version "0.0.3"
resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a"
Expand Down

0 comments on commit bce370e

Please sign in to comment.