diff --git a/packages/svelte/src/reactivity/date.test.ts b/packages/svelte/src/reactivity/date.test.ts index 7c868dde46..2c095f69b2 100644 --- a/packages/svelte/src/reactivity/date.test.ts +++ b/packages/svelte/src/reactivity/date.test.ts @@ -610,10 +610,10 @@ test('date fine grained tests', () => { }; const cleanup = effect_root(() => { - for (const key of Object.keys(date)) { + for (const key of Object.keys(changes)) { render_effect(() => { date[key](); - assert.equal(changes[key], true, test_description); + assert.equal(changes[key], true, `${test_description}: for ${key}`); }); } }); @@ -625,9 +625,13 @@ test('date fine grained tests', () => { getFullYear: true, getUTCFullYear: true, getDate: true, - getUTCDate: true + getUTCDate: true, + getMonth: true, + getUTCMonth: true, + getDay: true, + getUTCDay: true }; - test_description = 'changing full that will cause month change as well'; + test_description = 'changing setFullYear that will cause month/day change as well'; date.setFullYear(initial_date.getFullYear() + 1, initial_date.getMonth() + 1); }); @@ -645,11 +649,11 @@ test('date fine grained tests', () => { getUTCMinutes: true, getSeconds: true, getUTCSeconds: true, - getMilliSeconds: true, - getUTCMilliSeconds: true + getMilliseconds: true, + getUTCMilliseconds: true }; test_description = 'changing seconds that will change day/hour/minutes/seconds/milliseconds'; - date.setSeconds(60 * 60 * 25, 10); + date.setSeconds(60 * 60 * 25 + 1, 10); }); flushSync(() => { @@ -658,8 +662,10 @@ test('date fine grained tests', () => { ...changes, getMonth: true, getUTCMonth: true, - getMilliSeconds: true, - getUTCMilliSeconds: true + getDay: true, + getUTCDay: true, + getMilliseconds: true, + getUTCMilliseconds: true }; test_description = 'changing month'; date.setMonth(date.getMonth() + 1); diff --git a/packages/svelte/src/reactivity/url.test.ts b/packages/svelte/src/reactivity/url.test.ts index 51858d0efa..ac5026fc28 100644 --- a/packages/svelte/src/reactivity/url.test.ts +++ b/packages/svelte/src/reactivity/url.test.ts @@ -114,7 +114,7 @@ test('url.href', () => { test('url fine grained tests', () => { const url = new ReactiveURL('https://svelte.dev/'); - let changes: Record = { + let changes: Record = { hash: true, host: true, hostname: true, @@ -126,9 +126,7 @@ test('url fine grained tests', () => { port: true, protocol: true, search: true, - searchParams: true, - toJSON: true, - toString: true + searchParams: true }; let test_description: string = ''; @@ -139,39 +137,19 @@ test('url fine grained tests', () => { }; const cleanup = effect_root(() => { - render_effect(() => { - url.hash; - assert.equal(changes.hash, true, test_description); - }); - - render_effect(() => { - url.host; - assert.equal(changes.host, true, test_description); - }); - - render_effect(() => { - url.hostname; - assert.equal(changes.hostname, true, test_description); - }); - - render_effect(() => { - url.href; - assert.equal(changes.href, true, test_description); - }); - - render_effect(() => { - url.origin; - assert.equal(changes.origin, true, test_description); - }); - - render_effect(() => { - url.search; - assert.equal(changes.search, true, test_description); - }); + for (const key of Object.keys(changes) as Array) { + if (key === 'searchParams') { + continue; + } + render_effect(() => { + url[key]; + assert.equal(changes[key], true, `${test_description}: for ${key}`); + }); + } render_effect(() => { url.searchParams.get('fohoov'); - assert.equal(changes.searchParams, true, test_description); + assert.equal(changes.searchParams, true, `${test_description}: for searchParams`); }); }); @@ -184,7 +162,7 @@ test('url fine grained tests', () => { flushSync(() => { reset_change(); - changes = { ...changes, origin: true, href: true }; + changes = { ...changes, protocol: true, origin: true, href: true }; test_description = 'changing protocol'; url.protocol = 'http'; });