{"id":20604827,"url":"https://github.com/themost-framework/test","last_synced_at":"2026-02-03T15:01:04.905Z","repository":{"id":37979432,"uuid":"226319008","full_name":"themost-framework/test","owner":"themost-framework","description":"MOST Web Framework Codename Blueshift Test Api Server","archived":false,"fork":false,"pushed_at":"2025-06-28T18:37:44.000Z","size":1915,"stargazers_count":0,"open_issues_count":7,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-06T15:42:10.488Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/themost-framework.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-12-06T11:52:14.000Z","updated_at":"2025-06-28T18:37:24.000Z","dependencies_parsed_at":"2024-05-06T10:02:57.042Z","dependency_job_id":null,"html_url":"https://github.com/themost-framework/test","commit_stats":null,"previous_names":["themost-framework/themost-test"],"tags_count":33,"template":false,"template_full_name":null,"purl":"pkg:github/themost-framework/test","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/themost-framework%2Ftest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/themost-framework%2Ftest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/themost-framework%2Ftest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/themost-framework%2Ftest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/themost-framework","download_url":"https://codeload.github.com/themost-framework/test/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/themost-framework%2Ftest/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29047788,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-03T14:55:20.264Z","status":"ssl_error","status_checked_at":"2026-02-03T14:55:19.725Z","response_time":96,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2024-11-16T09:24:59.217Z","updated_at":"2026-02-03T15:01:04.897Z","avatar_url":"https://github.com/themost-framework.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![npm](https://img.shields.io/npm/v/@themost%2Ftest.svg)](https://www.npmjs.com/package/@themost%2Ftest)\n![](https://github.com/themost-framework/themost-test/workflows/test/badge.svg) \n![GitHub top language](https://img.shields.io/github/languages/top/themost-framework/test)\n[![License](https://img.shields.io/npm/l/@themost/test)](https://github.com/themost-framework/test/blob/master/LICENSE)\n![GitHub last commit](https://img.shields.io/github/last-commit/themost-framework/test)\n![GitHub Release Date](https://img.shields.io/github/release-date/themost-framework/test)\n[![npm](https://img.shields.io/npm/dw/@themost/test)](https://www.npmjs.com/package/@themost%2Ftest)\n\n## @themost/test\n[@themost-framework](https://github.com/themost-framework) Test API Server\n\n![Test API Server](./modules/test/server/assets/img/screenshot1.png)\n\n### Installation\n\n        npm i @themost/test\n        \n### Usage\n\nStart a standalone instance of test api server:\n\n        npx @themost/test [--port \u003cport\u003e] [--host \u003chost\u003e]\n\nGet a bearer token using `password grant` flow (read more at https://www.oauth.com/oauth2-servers/access-tokens/password-grant/)\n\n    curl --location 'http://localhost:3000/auth/token' \\\n    --header 'Content-Type: application/x-www-form-urlencoded' \\\n    --data-urlencode 'client_id=9165351833584149' \\\n    --data-urlencode 'client_secret=hTgqFBUhCfHs/quf/wnoB_UpDSfUusKA' \\\n    --data-urlencode 'username=alexis.rees@example.com' \\\n    --data-urlencode 'password=secret' \\\n    --data-urlencode 'grant_type=password' \\\n    --data-urlencode 'scope=profile'\n\n\u003e   \n    {\n      \"access_token\": \"\u003caccess token\u003e\",\n      \"token_type\": \"bearer\",\n      \"expires_in\": 3600,\n      \"scope\": \"profile\"\n    }\n\nand start making requests for getting data from test api server by using OData v4 protocol \n(read more at http://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part2-url-conventions.html)\n\ne.g. get products\n\n    curl --location 'http://localhost:3000/api/Products?%24select=category%2Cprice%2Cmodel%2CreleaseDate%2Cname' \\\n    --header 'Authorization: Bearer \u003caccess token\u003e'\n\nwith response:\n\n    {\n      \"value\": [\n        {\n            \"category\": \"Laptops\",\n            \"price\": 444.76,\n            \"model\": \"SR2155\",\n            \"releaseDate\": \"2019-04-21T16:43:59.000Z\",\n            \"name\": \"Apple MacBook Air (13.3-inch, 2013 Version)\"\n        },\n        {\n            \"category\": \"Laptops\",\n            \"price\": 357.84,\n            \"model\": \"LD1737\",\n            \"releaseDate\": \"2019-01-14T08:49:33.000Z\",\n            \"name\": \"Apple MacBook Pro With Retina Display (15-inch, 2013 Version)\"\n        }\n        ...\n      ]\n    }\n\nor create a jasmine test spec and start testing api server\n\n        import { getApplication, serveApplication, getServerAddress } from \"@themost/test\";\n        import fetch from \"node-fetch\";\n        describe(\"TestApi\", () =\u003e {\n          let server;\n          let server_uri;\n          beforeAll(done =\u003e {\n            const app = getApplication()\n            serveApplication(app)\n              .then(liveServer =\u003e {\n                server = liveServer;\n                server_uri = getServerAddress(server);\n                return done();\n              })\n              .catch(err =\u003e {\n                return done(err);\n              });\n          });\n          afterAll(done =\u003e {\n            if (server) {\n              server.close(() =\u003e {\n                return done();\n              });\n            }\n          });\n          it(\"should access server\", async () =\u003e {\n            expect(server).toBeTruthy();\n            const response = await fetch(new URL(\"/\", server_uri));\n            expect(response.ok).toBeTruthy();\n          });\n        });\n\n#### Karma Testing\n\nTest api server may be used alongside with [karma](https://github.com/karma-runner/karma) for testing.\n\nCreate karma-test-api-server.js:\n\n    // karma-test-api-server.js\n    const {getApplication, serveApplication, getServerAddress} = require('@themost/test');\n    const { URL } = require('url');\n    function serveKarmaTestApiServer(proxies) {\n        const app = getApplication();\n        return serveApplication(app).then( function(liveServer) {\n            const serverAddress = getServerAddress(liveServer);\n            Object.assign(proxies, {\n                '/api/': new URL('/api/', serverAddress).toString(),\n                '/auth/': new URL('/auth/', serverAddress).toString()\n            });\n        });\n    }\n    \n    serveKarmaTestApiServer.$inject = ['config.proxies'];\n    \n    module.exports =  {\n        'framework:api': [\n            'factory',\n            serveKarmaTestApiServer\n        ]\n    };\n\nand modify karma.conf.js to include test api server\n\n    // karma.conf.js\n    module.exports = function (config) {\n      config.set({\n        basePath: '',\n        frameworks: [..., ..., 'api'],\n        plugins: [\n          require('./karma-test-api-server'),\n          ...\n        ],\n        client: {\n          clearContext: false\n        }\n        ...\n        \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthemost-framework%2Ftest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthemost-framework%2Ftest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthemost-framework%2Ftest/lists"}