-
-
Notifications
You must be signed in to change notification settings - Fork 425
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
What version of Effect is running?
[email protected], @effect/[email protected]
What steps can reproduce the bug?
import assert from 'node:assert/strict';
import { describe, it } from 'node:test';
import { UrlParams } from '@effect/platform';
describe('setAll', () => {
it('concats, preferring elements from the second input with preservation', () => {
const prev = UrlParams.fromInput({
baz: 'c',
foo: 'd',
});
const neww = UrlParams.fromInput({
foo: 'a',
bar: 'b',
});
assert.deepEqual(UrlParams.toRecord(UrlParams.setAll(prev, neww)), {
foo: ['d', 'a'],
bar: 'b',
});
});
});What is the expected behavior?
The assertion result should instead be (order notwithstanding):
assert.deepEqual(UrlParams.toRecord(UrlParamsExtras.setAll(prev, neww)), {
baz: 'c',
foo: 'a',
bar: 'b',
});What do you see instead?
The above repro assertion:
assert.deepEqual(UrlParams.toRecord(UrlParams.setAll(prev, neww)), {
foo: ['d', 'a'],
bar: 'b',
});Additional information
This behaviour is confusing. Take UrlParams.set for example, which overwrites a single key but leaves others alone:
assert.deepEqual(UrlParams.toRecord(UrlParams.set(prev, 'foo', 'a')), {
baz: 'c',
foo: 'a',
});The test passes my expected assertion if the keys.includes predicate is negated/inverted here: https://github.com/Effect-TS/effect/blob/%40effect/platform%400.92.1/packages/platform/src/UrlParams.ts#L164
OliverJAsh
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working