Commit 324f7b40 authored by Michael Comella's avatar Michael Comella Committed by Sebastian Kaspari
Browse files

Issue #651: Add PocketTestResource from FFTV.

This was added from FFTV:
  https://github.com/mozilla-mobile/firefox-tv/blob/785501a9eb6c68386b84d0f1104fc5b2f19ed9cb/app/src/test/java/org/mozilla/tv/firefox/TestResource.kt

It was modified slightly: the second item in the test data array had
its `tv_url` and `authors` field restored (from FFTV git history). The
test data data was modified in the FFTV repo so we could test our fallback
behavior. However, the API provided by a-c should be 100% faithful to
the API's returned data and the applications should decide fallback
behavior so these modifications for FFTV are no longer necessary. Also,
it's bad practice to modify the test data with such tests because that test
data could be updated, removing these modifications. Instead, the test
code should generate the test data necessary to replicate and test this
behavior.
parent 649e83bb
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package mozilla.components.service.pocket.helpers
private const val POCKET_DIR = "pocket"
/**
* Accessors to resources used in testing. These files are available in `app/src/test/resources`.
*/
enum class PocketTestResource(private val path: String) {
POCKET_VIDEO_RECOMMENDATION("$POCKET_DIR/video_recommendations.json");
fun get(): String = this::class.java.classLoader!!.getResource(path)!!.readText()
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment