{"id":17371940,"url":"https://github.com/juliuste/fpti-tests","last_synced_at":"2025-04-18T23:58:43.121Z","repository":{"id":57241258,"uuid":"146613877","full_name":"juliuste/fpti-tests","owner":"juliuste","description":" Collection of validator/test functions for FPTI (Friendly Public Transport Interface) modules. ","archived":false,"fork":false,"pushed_at":"2020-05-25T04:13:17.000Z","size":60,"stargazers_count":1,"open_issues_count":8,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-16T14:24:30.498Z","etag":null,"topics":["library","public-transport"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/juliuste.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-29T14:39:31.000Z","updated_at":"2020-06-03T21:28:35.000Z","dependencies_parsed_at":"2022-09-07T23:13:13.005Z","dependency_job_id":null,"html_url":"https://github.com/juliuste/fpti-tests","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juliuste%2Ffpti-tests","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juliuste%2Ffpti-tests/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juliuste%2Ffpti-tests/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juliuste%2Ffpti-tests/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/juliuste","download_url":"https://codeload.github.com/juliuste/fpti-tests/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249565328,"owners_count":21292427,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["library","public-transport"],"created_at":"2024-10-16T01:09:13.566Z","updated_at":"2025-04-18T23:58:43.101Z","avatar_url":"https://github.com/juliuste.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fpti-tests\n\nThis package provides a collection of validator/test methods for [FPTI-JS](https://github.com/juliuste/fpti-js) (Friendly Public Transport Interface) modules.\n\n[![npm version](https://img.shields.io/npm/v/fpti-tests.svg)](https://www.npmjs.com/package/fpti-tests)\n[![Build Status](https://travis-ci.org/juliuste/fpti-tests.svg?branch=master)](https://travis-ci.org/juliuste/fpti-tests)\n[![Greenkeeper badge](https://badges.greenkeeper.io/juliuste/fpti-tests.svg)](https://greenkeeper.io/)\n[![dependency status](https://img.shields.io/david/juliuste/fpti-tests.svg)](https://david-dm.org/juliuste/fpti-tests)\n[![license](https://img.shields.io/github/license/juliuste/fpti-tests.svg?style=flat)](license)\n[![chat on gitter](https://badges.gitter.im/juliuste.svg)](https://gitter.im/juliuste)\n\n## Installation\n\n```shell\nnpm install fpti-tests\n```\n\n## API\n\n### General methods\n\nThese two methods should be used in every package.\n\n#### `packageJson(pkg)`\n\nTakes the contents of your package's `package.json` and returns a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/promise). Throws if the given package.json is invalid. Will check the version of `validate-fptf` used by your module.\n\n```js\nconst tests = require('fpti-tests')\nconst pkg = require('./package.json') // your-package/package.json\n\nconst test = async () =\u003e {\n    await tests.packageJson(pkg) // throws when invalid\n}\n```\n\n#### `packageExports(module, expectedMethods)`\n\nTakes the `module.exports` of your module and a list of supported FPTI methods. Throws if `expectedMethods` doesn't match the module's exports or if the module structure is invalid.\n\n```js\nconst tests = require('fpti-tests')\nconst module = require('.') // your-package\n\nconst test = () =\u003e {\n    tests.packageExports(module, ['stations.all', 'stops.nearby', 'stopovers']) // throws when invalid\n}\n```\n\n### Feature check methods\n\nUse those for the FPTI methods exposed by your module: Check if the `features` object exported by your FPTI methods matches the spec and a given list of `expected` options.\n\nExample for the `stopovers` method:\n\n```js\nconst tests = require('fpti-tests')\nconst stopoversFeatures = require('.').stopovers.features // your-package\n\nconst test = () =\u003e {\n    tests.stopoversFeatures(stopoversFeatures, ['interval', 'when', 'departureAfter', 'results', 'direction']) // throws when invalid, given a list of expected options\n}\n```\n\nAll methods:\n\n- `stationsAllFeatures(features, expectedList)`\n- `stationsNearbyFeatures(features, expectedList)`\n- `stationsSearchFeatures(features, expectedList)`\n- `stopsAllFeatures(features, expectedList)`\n- `stopsNearbyFeatures(features, expectedList)`\n- `stopsSearchFeatures(features, expectedList)`\n- `regionsAllFeatures(features, expectedList)`\n- `regionsNearbyFeatures(features, expectedList)`\n- `regionsSearchFeatures(features, expectedList)`\n- `stopoversFeatures(features, expectedList)`\n- `journeysFeatures(features, expectedList)`\n\n## Contributing\n\nIf you found a bug or want to propose a feature, feel free to visit [the issues page](https://github.com/juliuste/fpti-tests/issues).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuliuste%2Ffpti-tests","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjuliuste%2Ffpti-tests","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuliuste%2Ffpti-tests/lists"}