nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: jchambers/pushy
Pull request #796 (2020-07-15 07:54:53)

json parser fix
fix of issue: https://github.com/jchambers/pushy/issues/795

kissmikki: > Also, may I ask how this came to your attention? While I agree that this is a bug, I think the only things Pushy should be parsing in production are APNs error responses. Did you encounter this issue while using Pushy in normal operation, or were you trying to do something fancier?

We have a set of notification artifacts that handle a various client notifications such as sending push to iOS. I used Pushy to create a new artifact that fits into our existing framework and since I saw it has a json parser I used it. I extract a key from the string encoded payload (which is generated by Pushy's PayloadBuilder) and noticesdthat the decoded values were different from the encoded ones.

Sure, I can move the test - when I'm back from holiday.
jchambers: > Sure, I can move the test - when I'm back from holiday.

Don't sweat it. I'll just merge this and do a quick follow-up commit.

As soon as I can figure out why Travis isn't running tests, anyhow. Hm.
jchambers: Well, the tests definitely passed: https://travis-ci.org/github/jchambers/pushy/builds/708254193. It looks like the results just didn't make it back to github. I'll go ahead and merge this. Thank you for the contribution!

Patch:
diff --git a/pushy/src/main/java/com/eatthepath/json/JsonParser.java b/pushy/src/main/java/com/eatthepath/json/JsonParser.java
index 892c143e..eaf82fd0 100644
--- a/pushy/src/main/java/com/eatthepath/json/JsonParser.java
+++ b/pushy/src/main/java/com/eatthepath/json/JsonParser.java
@@ -250,7 +250,7 @@ public class JsonParser {
                 if (stringBuilder.length() == 0) {
                     unescapedString = jsonString.substring(start, position);
                 } else {
-                    stringBuilder.append(jsonString, start, jsonString.length() - 1);
+                    stringBuilder.append(jsonString, start, position);
                     unescapedString = stringBuilder.toString();
                 }
 


Test patch:
diff --git a/pushy/src/test/java/com/eatthepath/json/JsonParserTest.java b/pushy/src/test/java/com/eatthepath/json/JsonParserTest.java
index 4667c3fd..4216dc0e 100644
--- a/pushy/src/test/java/com/eatthepath/json/JsonParserTest.java
+++ b/pushy/src/test/java/com/eatthepath/json/JsonParserTest.java
@@ -194,4 +194,13 @@ class JsonParserTest {
                 arguments("", 1),
                 arguments("test", 5));
     }
+
+    @Test
+    void testComplexParse() throws ParseException
+    {
+        final JsonParser jsonParser = new JsonParser();
+        final Map<String, Object> parsedMap = jsonParser.parseJsonObject("{\"key1\":\"value\\/1\",\"key2\":\"value\\/2\"}");
+        assertEquals("value/1", parsedMap.get("key1"));
+        assertEquals("value/2", parsedMap.get("key2"));
+    }
 }
Repository: remarkablemark/html-react-parser
Pull request #212 (2021-01-17 03:46:05)

test(integration): add tests for UMD bundle and fail build if there are warnings
## What is the motivation for this pull request?

test: add integration tests for UMD bundle and fail build if there are warnings

## What is the current behavior?

- No integration tests for UMD bundle
- Rollup build does not fail if there are warnings

## What is the new behavior?

- Added integration tests for UMD bundle
- Rollup build fails if there are warnings

## Checklist:

- [x] Tests



Patch:
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index a336c8a..f3cf8ad 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -19,7 +19,7 @@ jobs:
       - run: npm run lint
       - run: npm run lint:dts
       - run: npm run test:ci
-      - run: npm run build
+      - run: npm run test:integration
       - run: npm run benchmark
       - name: Coveralls
         uses: coverallsapp/github-action@master
diff --git a/package.json b/package.json
index f1a5858..7c6ed51 100644
--- a/package.json
+++ b/package.json
@@ -7,15 +7,16 @@
   "module": "index.mjs",
   "scripts": {
     "benchmark": "node benchmark",
-    "build": "rollup --config",
+    "build": "rollup --config --failAfterWarnings",
     "clean": "rimraf dist",
     "lint": "eslint --ignore-path .gitignore --ignore-pattern /examples/ .",
     "lint:dts": "dtslint .",
     "lint:fix": "npm run lint -- --fix",
     "prepublishOnly": "npm run lint && npm run lint:dts && npm run test:ci && npm run clean && npm run build",
     "release": "standard-version --no-verify",
-    "test": "jest --coverage",
+    "test": "jest --coverage --testPathIgnorePatterns test/integration/",
     "test:ci": "npm test -- --ci",
+    "test:integration": "npm run build && jest test/integration/",
     "test:watch": "npm test -- --watch"
   },
   "repository": {


Test patch:
diff --git a/test/integration/index.test.js b/test/integration/index.test.js
new file mode 100644
index 0000000..a964e3e
--- /dev/null
+++ b/test/integration/index.test.js
@@ -0,0 +1,26 @@
+describe.each([
+  ['unminified', '../../dist/html-react-parser'],
+  ['minified', '../../dist/html-react-parser.min']
+])('UMD %s', (_type, path) => {
+  const parse = require(path);
+
+  it('exports the parser', () => {
+    expect(parse).toBeInstanceOf(Function);
+  });
+
+  it('exports default', () => {
+    expect(parse.default).toBeInstanceOf(Function);
+  });
+
+  it('exports domToReact', () => {
+    expect(parse.domToReact).toBeInstanceOf(Function);
+  });
+
+  it('exports htmlToDOM', () => {
+    expect(parse.htmlToDOM).toBeInstanceOf(Function);
+  });
+
+  it('exports attributesToProps', () => {
+    expect(parse.attributesToProps).toBeInstanceOf(Function);
+  });
+});
Repository: remarkablemark/html-react-parser
Pull request #225 (2021-02-06 05:57:46)

test(module): write ES module unit test
## What is the motivation for this pull request?

test(module): write ES module unit test

## What is the current behavior?

No ES module unit test.

## What is the new behavior?

ES module unit test.

## Checklist:

- [x] Tests



Patch:
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index f3cf8ad..9dcd689 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -19,6 +19,7 @@ jobs:
       - run: npm run lint
       - run: npm run lint:dts
       - run: npm run test:ci
+      - run: npm run test:module
       - run: npm run test:integration
       - run: npm run benchmark
       - name: Coveralls
diff --git a/package.json b/package.json
index 9d2a8d3..c10eab2 100644
--- a/package.json
+++ b/package.json
@@ -16,6 +16,7 @@
     "release": "standard-version --no-verify",
     "test": "jest --coverage --testPathIgnorePatterns test/integration/",
     "test:ci": "npm test -- --ci",
+    "test:module": "node --experimental-modules test/module/index.mjs",
     "test:integration": "npm run build && jest test/integration/",
     "test:watch": "npm test -- --watch"
   },


Test patch:
diff --git a/test/module/index.mjs b/test/module/index.mjs
new file mode 100644
index 0000000..79ed70a
--- /dev/null
+++ b/test/module/index.mjs
@@ -0,0 +1,10 @@
+import assert from 'assert';
+import parse, {
+  domToReact,
+  htmlToDOM,
+  attributesToProps
+} from '../../index.mjs';
+
+[parse, domToReact, htmlToDOM, attributesToProps].forEach(func => {
+  assert.strictEqual(typeof func, 'function');
+});
Repository: remarkablemark/html-react-parser
Pull request #569 (2022-05-30 23:16:26)

fix: bump `style-to-js` to 1.1.1; don't capitalize `-ms` vendor prefix
Relates to https://github.com/remarkablemark/style-to-js/issues/2, https://github.com/remarkablemark/style-to-js/pull/3

## What is the motivation for this pull request?

fix: don't capitalize `-ms` vendor prefix

## What is the current behavior?

[style-to-js@1.1.0](https://github.com/remarkablemark/style-to-js/releases/tag/v1.1.0) capitalizes `-ms` vendor prefix

## What is the new behavior?

[style-to-js@1.1.1](https://github.com/remarkablemark/style-to-js/releases/tag/v1.1.1) doesn't capitalize `-ms` vendor prefix

## Checklist:

- [x] [Conventional Commits](https://www.conventionalcommits.org/)
- [x] Tests


Patch:
diff --git a/.size-limit.json b/.size-limit.json
index 6f67836..aaa687b 100644
--- a/.size-limit.json
+++ b/.size-limit.json
@@ -1,6 +1,6 @@
 [
   {
     "path": "dist/html-react-parser.min.js",
-    "limit": "10.52 KB"
+    "limit": "10.531 KB"
   }
 ]
diff --git a/package.json b/package.json
index c2a0c9c..ab46f4c 100644
--- a/package.json
+++ b/package.json
@@ -47,7 +47,7 @@
     "domhandler": "4.3.1",
     "html-dom-parser": "1.2.0",
     "react-property": "2.0.0",
-    "style-to-js": "1.1.0"
+    "style-to-js": "1.1.1"
   },
   "devDependencies": {
     "@commitlint/cli": "17.0.1",


Test patch:
diff --git a/test/attributes-to-props.test.js b/test/attributes-to-props.test.js
index 4371192..1366645 100644
--- a/test/attributes-to-props.test.js
+++ b/test/attributes-to-props.test.js
@@ -253,19 +253,21 @@ describe('attributesToProps with style attribute', () => {
         color: #f00; font-size: 42px; z-index: -1; -webkit-border-top-right-radius: 10rem; background: url(data:image/png; base64,ivborw0kggoaaaansaaaabgdbtueaalgpc/xhbqaaaafzmuexurczmzpf399fx1+bm5mzy9avzxbesmgces5/p8/t9furvcrmu73jwlzosgsiizurcjo/ad+eqjjb4hv8bft+idpqocx1wjosbfhh2xssxeiyn3uli/6mnree07uiwjev8u8czwyuqdlkpg1bkb4nnm+veanfhqn1k4+gpt6ugqcvu2h2ovuif);
         /* display: block;  */
         --custom-property: #f00;
-        border-bottom-left-radius:1em;border-right-style:solid;Z-Index:-1;-moz-border-radius-bottomleft:20px'
+        border-bottom-left-radius:1em;border-right-style:solid;Z-Index:-1;-moz-border-radius-bottomleft:20px;
+        -ms-transform: none;
       `;
     expect(attributesToProps({ style })).toMatchInlineSnapshot(`
       Object {
         "style": Object {
           "--custom-property": "#f00",
-          "MozBorderRadiusBottomleft": "20px'",
+          "MozBorderRadiusBottomleft": "20px",
           "WebkitBorderTopRightRadius": "10rem",
           "background": "url(data:image/png; base64,ivborw0kggoaaaansaaaabgdbtueaalgpc/xhbqaaaafzmuexurczmzpf399fx1+bm5mzy9avzxbesmgces5/p8/t9furvcrmu73jwlzosgsiizurcjo/ad+eqjjb4hv8bft+idpqocx1wjosbfhh2xssxeiyn3uli/6mnree07uiwjev8u8czwyuqdlkpg1bkb4nnm+veanfhqn1k4+gpt6ugqcvu2h2ovuif)",
           "borderBottomLeftRadius": "1em",
           "borderRightStyle": "solid",
           "color": "#f00",
           "fontSize": "42px",
+          "msTransform": "none",
           "zIndex": "-1",
         },
       }
Repository: remarkablemark/html-react-parser
Pull request #620 (2022-07-05 21:51:29)

build: upgrade domhandler to 5.0.3 and html-dom-parser to 3.0.0
Relates to https://github.com/remarkablemark/html-dom-parser/pull/314

## What is the motivation for this pull request?

BREAKING CHANGE: bump `domhandler` from 4 to 5 and `html-dom-parser` from 2 to 3

```
 domhandler       4.3.1  →  5.0.3
 html-dom-parser  2.0.0  →  3.0.0
```

## What is the current behavior?

- domhandler@4.3.1
- html-dom-parser@2.0.0

## What is the new behavior?

- domhandler@5.0.3
- html-dom-parser@3.0.0

## Checklist:

- [x] [Conventional Commits](https://www.conventionalcommits.org/)
- [x] Tests
- [x] Types
- [x] Documentation


Patch:
diff --git a/README.md b/README.md
index 9c54db3..c5cd7db 100644
--- a/README.md
+++ b/README.md
@@ -41,6 +41,7 @@ parse('<p>Hello, World!</p>'); // React.createElement('p', {}, 'Hello, World!')
   - [htmlparser2](#htmlparser2)
   - [trim](#trim)
 - [Migration](#migration)
+  - [v3.0.0](#v300)
   - [v2.0.0](#v200)
   - [v1.0.0](#v100)
 - [FAQ](#faq)
@@ -371,6 +372,10 @@ parse('<p> </p>', { trim: true }); // React.createElement('p')
 
 ## Migration
 
+### v3.0.0
+
+[domhandler](https://github.com/fb55/domhandler) has been upgraded to v5 so some [parser options](https://github.com/fb55/htmlparser2/wiki/Parser-options) like `normalizeWhitespace` have been removed.
+
 ### v2.0.0
 
 Since [v2.0.0](https://github.com/remarkablemark/html-react-parser/releases/tag/v2.0.0), Internet Explorer (IE) is no longer supported.
diff --git a/package.json b/package.json
index 2b39377..0ca9c7c 100644
--- a/package.json
+++ b/package.json
@@ -44,8 +44,8 @@
     "dom"
   ],
   "dependencies": {
-    "domhandler": "4.3.1",
-    "html-dom-parser": "2.0.0",
+    "domhandler": "5.0.3",
+    "html-dom-parser": "3.0.0",
     "react-property": "2.0.0",
     "style-to-js": "1.1.1"
   },


Test patch:
diff --git a/test/types/index.tsx b/test/types/index.tsx
index 5ee9b28..274fcd3 100644
--- a/test/types/index.tsx
+++ b/test/types/index.tsx
@@ -86,7 +86,7 @@ parse('<p/><p/>', {
 // $ExpectType string | Element | Element[]
 parse('\t<p>text \r</p>\n', { trim: true });
 
-// $ExpectType (Text | Comment | ProcessingInstruction | Element)[]
+// $ExpectType (Element | Text | Comment | ProcessingInstruction)[]
 const domNodes = htmlToDOM('<div>text</div>');
 
 // $ExpectType string | Element | Element[]
diff --git a/test/types/lib/dom-to-react.tsx b/test/types/lib/dom-to-react.tsx
index b9a6a1f..986e587 100644
--- a/test/types/lib/dom-to-react.tsx
+++ b/test/types/lib/dom-to-react.tsx
@@ -4,7 +4,7 @@ import domToReact from 'html-react-parser/lib/dom-to-react';
 import * as React from 'react';
 import htmlToDOM from 'html-dom-parser';
 
-// $ExpectType (Text | Comment | ProcessingInstruction | Element)[]
+// $ExpectType (Element | Text | Comment | ProcessingInstruction)[]
 htmlToDOM('<div>text</div>');
 
 // $ExpectType string | Element | Element[]
Repository: remarkablemark/html-react-parser
Pull request #1127 (2023-10-29 19:31:44)

fix(dom-to-react): default props.children to `undefined` instead of `null`
## What is the motivation for this pull request?

fix(dom-to-react): default props.children to undefined instead of null

## What is the current behavior?

props.children defaults to `null`. E.g., `parse('<br>')`:

```js
{
  '$$typeof': Symbol(react.element),
  type: 'br',
  key: null,
  ref: null,
  props: { children: null },
  _owner: null,
  _store: {}
}
```

## What is the new behavior?

props.children defaults to `undefined`

This ensures the parsed element is consistent with the React element `<br >`:

```js
{
  '$$typeof': Symbol(react.element),
  type: 'br',
  key: null,
  ref: null,
  props: {},
  _owner: null,
  _store: {}
}
```

## Checklist:

- [x] [Conventional Commits](https://www.conventionalcommits.org/)
- [x] Tests
- [ ] Documentation


Patch:
diff --git a/src/dom-to-react.ts b/src/dom-to-react.ts
index 01eb41f..70780e6 100644
--- a/src/dom-to-react.ts
+++ b/src/dom-to-react.ts
@@ -96,7 +96,7 @@ export default function domToReact(
       props = attributesToProps(element.attribs, element.name);
     }
 
-    let children = null;
+    let children;
 
     switch (node.type) {
       case 'script':


Test patch:
diff --git a/__tests__/dom-to-react.test.tsx b/__tests__/dom-to-react.test.tsx
index 3add2a4..e99509d 100644
--- a/__tests__/dom-to-react.test.tsx
+++ b/__tests__/dom-to-react.test.tsx
@@ -84,7 +84,7 @@ describe('domToReact', () => {
 
   it('does not have `children` for void elements', () => {
     const reactElement = domToReact(htmlToDOM(html.img)) as JSX.Element;
-    expect(reactElement.props.children).toBe(null);
+    expect(reactElement.props.children).toBe(undefined);
   });
 
   it('does not throw an error for void elements', () => {
Repository: mostjs/core
Pull request #107 (2017-08-10 22:35:25)

fix(debounce): ensure debounce disposes source
Ported from https://github.com/cujojs/most/pull/472

It looks like there was also a bug in the DebounceSink constructor.  It wasn't correct to use disposeBoth, since the DebounceSink instance is already the disposable that is being returned from run().


Patch:
diff --git a/packages/core/src/combinator/limit.js b/packages/core/src/combinator/limit.js
index 73c9bc0..ad2a48e 100644
--- a/packages/core/src/combinator/limit.js
+++ b/packages/core/src/combinator/limit.js
@@ -1,9 +1,6 @@
-/** @license MIT License (c) copyright 2010-2016 original author or authors */
-/** @author Brian Cavalier */
-/** @author John Hann */
+/** @license MIT License (c) copyright 2010-2017 original author or authors */
 
 import Pipe from '../sink/Pipe'
-import { disposeBoth } from '@most/disposable'
 import { propagateEventTask } from '../scheduler/PropagateTask'
 import Map from '../fusion/Map'
 
@@ -78,8 +75,7 @@ class DebounceSink {
     this.value = void 0
     this.timer = null
 
-    const sourceDisposable = source.run(this, scheduler)
-    this.disposable = disposeBoth(this, sourceDisposable)
+    this.disposable = source.run(this, scheduler)
   }
 
   event (t, x) {
@@ -103,6 +99,7 @@ class DebounceSink {
 
   dispose () {
     this._clearTimer()
+    this.disposable.dispose()
   }
 
   _clearTimer () {


Test patch:
diff --git a/packages/core/test/limit-test.js b/packages/core/test/limit-test.js
index 98b9772..d4bad33 100644
--- a/packages/core/test/limit-test.js
+++ b/packages/core/test/limit-test.js
@@ -1,16 +1,17 @@
 import { describe, it } from 'mocha'
 import { eq, is, assert } from '@briancavalier/assert'
+import { spy } from 'sinon'
 
 import { debounce, throttle } from '../src/combinator/limit'
 import { zip } from '../src/combinator/zip'
 import { map } from '../src/combinator/transform'
-import { take } from '../src/combinator/slice'
 import { empty } from '../src/source/empty'
 import { now } from '../src/source/now'
 import { default as Map } from '../src/fusion/Map'
 
 import { atTimes, collectEventsFor, makeEventsFromArray, makeEvents } from './helper/testEnv'
 import { assertSame } from './helper/stream-helper'
+import FakeDisposeSource from './helper/FakeDisposeStream'
 
 const sentinel = { value: 'sentinel' }
 
@@ -78,6 +79,15 @@ describe('debounce', function () {
         { time: 7, value: 2 }
       ]))
   })
+
+  it('should dispose source', () => {
+    const dispose = spy()
+    const s = new FakeDisposeSource(dispose, now(sentinel))
+    const debounced = debounce(1, s)
+
+    return collectEventsFor(1, debounced).then(() =>
+      assert(dispose.calledOnce))
+  })
 })
 
 describe('throttle', function () {
@@ -119,7 +129,7 @@ describe('throttle', function () {
 
   it('should be identity when period === 0 and all items are simultaneous', function () {
     const a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
-    const s = take(10, makeEventsFromArray(0, a))
+    const s = makeEventsFromArray(0, a)
     return assertSame(s, throttle(0, s))
   })
Repository: mostjs/core
Pull request #209 (2018-01-26 02:31:39)

Port debounce fix from cujojs/most#515
Post debounce fix from cujojs/most#515

See also https://github.com/cujojs/most/issues/514

### Todo

- [x] Unit test


Patch:
diff --git a/packages/core/src/combinator/limit.js b/packages/core/src/combinator/limit.js
index 28a92e5..3842c25 100644
--- a/packages/core/src/combinator/limit.js
+++ b/packages/core/src/combinator/limit.js
@@ -1,7 +1,6 @@
 /** @license MIT License (c) copyright 2010-2017 original author or authors */
 
 import Pipe from '../sink/Pipe'
-import { propagateEventTask } from '../scheduler/PropagateTask'
 import Map from '../fusion/Map'
 import { empty, isCanonicalEmpty } from '../source/empty'
 import { delay } from '@most/scheduler'
@@ -85,7 +84,12 @@ class DebounceSink {
   event (t, x) {
     this._clearTimer()
     this.value = x
-    this.timer = delay(this.dt, propagateEventTask(x, this.sink), this.scheduler)
+    this.timer = delay(this.dt, new DebounceTask(this, x), this.scheduler)
+  }
+
+  _event (t, x) {
+    this._clearTimer()
+    this.sink.event(t, x)
   }
 
   end (t) {
@@ -115,3 +119,20 @@ class DebounceSink {
     return true
   }
 }
+
+class DebounceTask {
+  constructor (debounce, value) {
+    this.debounce = debounce
+    this.value = value
+  }
+
+  run (t) {
+    this.debounce._event(t, this.value)
+  }
+
+  error (t, e) {
+    this.debounce.error(t, e)
+  }
+
+  dispose () {}
+}


Test patch:
diff --git a/packages/core/test/limit-test.js b/packages/core/test/limit-test.js
index 23a79e0..f7fa233 100644
--- a/packages/core/test/limit-test.js
+++ b/packages/core/test/limit-test.js
@@ -4,8 +4,12 @@ import { spy } from 'sinon'
 
 import { debounce, throttle } from '../src/combinator/limit'
 import { zip } from '../src/combinator/zip'
+import { startWith } from '../src/combinator/startWith'
+import { delay } from '../src/combinator/delay'
 import { map } from '../src/combinator/transform'
+import { until } from '../src/combinator/timeslice'
 import { empty, isCanonicalEmpty } from '../src/source/empty'
+import { never } from '../src/source/never'
 import { now } from '../src/source/now'
 import { default as Map } from '../src/fusion/Map'
 
@@ -65,6 +69,17 @@ describe('debounce', function () {
     })
   })
 
+  it('should not repeat last event when end is delayed', () => {
+    // See https://github.com/cujojs/most/issues/514
+    const expected = Math.random()
+    const endAtTicks = 5
+    const end = delay(endAtTicks, now(null))
+    const debounced = debounce(1, until(end, startWith(expected, never())))
+
+    return collectEventsFor(endAtTicks, debounced)
+      .then(eq([{ time: 1, value: expected }]))
+  })
+
   it('should allow events that occur less frequently than debounce period', function () {
     const s = atTimes([
       { time: 0, value: 0 },
Repository: mostjs/core
Pull request #244 (2018-07-16 19:27:09)

fix(delay) fixes the cancelAll predicate within DelaySink dispose
Init PR based on our slack conversation, addresses the bug described in #243 


Patch:
diff --git a/packages/core/src/combinator/delay.js b/packages/core/src/combinator/delay.js
index 9bd89ba..c7f18da 100644
--- a/packages/core/src/combinator/delay.js
+++ b/packages/core/src/combinator/delay.js
@@ -35,7 +35,7 @@ class DelaySink extends Pipe {
   }
 
   dispose () {
-    cancelAllTasks(task => task.sink === this.sink, this.scheduler)
+    cancelAllTasks(({ task }) => task.sink === this.sink, this.scheduler)
   }
 
   event (t, x) {


Test patch:
diff --git a/packages/core/test/delay-test.js b/packages/core/test/delay-test.js
index 3e130d3..9c051ed 100644
--- a/packages/core/test/delay-test.js
+++ b/packages/core/test/delay-test.js
@@ -3,6 +3,9 @@ import { eq } from '@briancavalier/assert'
 
 import { delay } from '../src/combinator/delay'
 import { now } from '../src/source/now'
+import { switchLatest } from '../src/combinator/switch'
+import { merge } from '../src/combinator/merge'
+import { map } from '../src/combinator/transform'
 
 import { collectEventsFor } from './helper/testEnv'
 
@@ -15,4 +18,15 @@ describe('delay', function () {
     return collectEventsFor(time + 1, s)
       .then(eq([{ time, value }]))
   })
+  it('should produce a single event', function () {
+    const time = 700
+    const value = 2
+    const request = merge(now(1), delay(200, now(2)))
+    const result = map(request => delay(500, now(request)), request)
+
+    const latest = switchLatest(result)
+
+    return collectEventsFor(time, latest)
+      .then(eq([{ time, value }]))
+  })
 })