# Probleme beim Hinzufügen eines einfachen Unit-Tests für Youtube Oneboxing

**URL:** <https://meta.discourse.org/t/trouble-on-adding-a-simple-unit-test-for-youtube-oneboxing/247546>\
**Category:** Development\
**Tags:** onebox, testing\
**Created:** [2. Dezember 2022 um 20:49 UTC](https://meta.discourse.org/t/trouble-on-adding-a-simple-unit-test-for-youtube-oneboxing/247546 "2022-12-02T20:49:55Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)\
**Post date:** [5. Dezember 2022 um 23:43 UTC](https://meta.discourse.org/t/trouble-on-adding-a-simple-unit-test-for-youtube-oneboxing/247546/5 "2022-12-05T23:43:16Z")

</div>

Ich habe es in einem neuen PR behoben, der Ihnen als Co-Autor korrekt zugeschrieben wird:

> <https://github.com/discourse/discourse/pull/19335>

> [@Canapin](#):
>
> Warum gibt es doppelte /embed/-Links und warum hat `onebox_response` einen anderen String-Parameter?

Damit unsere Testsuite nicht von einer funktionierenden Internetverbindung (und funktionierendem Youtube) abhängt, stubben wir alle Internetanfragen, indem wir diese Aufrufe mit einer gecachten Antwort zurückgeben. Die Funktion `onebox_response` ruft die Datei mit einem übereinstimmenden Namen als Parameter aus dem Ordner [discourse/spec/fixtures/onebox at main · discourse/discourse · GitHub](https://github.com/discourse/discourse/tree/main/spec/fixtures/onebox) auf.

Ich habe eine neue .response-Datei für Shorts hinzugefügt, damit wir einen guten Test haben, aber das war alles, was dafür notwendig war. Danke für den PR!

---

_[View the full topic](https://meta.discourse.org/t/trouble-on-adding-a-simple-unit-test-for-youtube-oneboxing/247546)._
