{"id":15017385,"url":"https://github.com/mortalflesh/jasmine-data-provider","last_synced_at":"2025-04-12T11:43:05.889Z","repository":{"id":30082432,"uuid":"33632022","full_name":"MortalFlesh/jasmine-data-provider","owner":"MortalFlesh","description":null,"archived":false,"fork":false,"pushed_at":"2018-09-29T08:22:05.000Z","size":4,"stargazers_count":30,"open_issues_count":0,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-09T15:05:17.409Z","etag":null,"topics":["data-provider","jasmine"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/jasmine-data-provider","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MortalFlesh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-04-08T21:00:21.000Z","updated_at":"2023-07-25T09:18:50.000Z","dependencies_parsed_at":"2022-08-03T15:12:58.024Z","dependency_job_id":null,"html_url":"https://github.com/MortalFlesh/jasmine-data-provider","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MortalFlesh%2Fjasmine-data-provider","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MortalFlesh%2Fjasmine-data-provider/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MortalFlesh%2Fjasmine-data-provider/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MortalFlesh%2Fjasmine-data-provider/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MortalFlesh","download_url":"https://codeload.github.com/MortalFlesh/jasmine-data-provider/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248564017,"owners_count":21125399,"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":["data-provider","jasmine"],"created_at":"2024-09-24T19:50:23.390Z","updated_at":"2025-04-12T11:43:05.858Z","avatar_url":"https://github.com/MortalFlesh.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jasmine - data provider\n\n- I am used to use data provider in PHPunit so I have been searching for some solution in jasmine\n- but I found only this (https://github.com/jphpsf/jasmine-data-provider), problem is, this is just for jasmine v1.2\n- so I updated it\n- now you can use Jasmine 2.2.0 and use data providers just like that:\n\n## Usage\n```javascript\nvar using = require('jasmine-data-provider');\n\ndescribe('test subtraction with data provider - direct array', function () {\n    using([{a: 5, b: 2, expected: 3}, {a: 25, b: 26, expected: -1}], function (data) {\n        it('should calc with operator -', function () {\n            var result = calculator.calc(data.a, data.b, '-');\n\n            expect(result).toEqual(data.expected);\n        });\n    });\n});\n```\n\nUsing function as a data provider\n```javascript\ndescribe('test addition with data provider - provider function', function () {\n    function plusProvider() {\n        return [\n            {a: 2, b: 3, expected: 5},\n            {a: '14', b: 15, expected: 29},\n            {a: 12, b: '13', expected: 25},\n            {a: '22', b: '13', expected: 35},\n        ];\n    }\n\n    using(plusProvider, function (data) {\n        it('should calc with operator +', function () {\n            var result = calculator.calc(data.a, data.b, '+');\n\n            expect(result).toEqual(data.expected);\n        });\n    });\n});\n```\n\nNow you can use object with a description that is passed into to the callback function as the last parameter\n```javascript\ndescribe('My fantastic test', function () {\n    var objectDataProvider = {\n        'First one is awesome!': {a: 6, b: 3, expected: 9},\n        'Second test should fail': {a: 8, b: 1, expected: 10}\n    };\n\n    using(objectDataProvider, function (data, description) {\n        it(description, function () {\n            var result = calculator.calc(data.a, data.b, '+');\n\n            expect(result).toEqual(data.expected);\n        });\n    });\n});\n```\n\n## JS Module Loaders\n\nCommonJS (like browserify), AMD (like requirejs)\n\n## Browser compatibility\n\nChrome 5+, Firefox 4+, Opera 12+, Safari 5+ and Internet Explorer 9+ (oh yeah..)\n\n## Installation\n \n    npm install jasmine-data-provider\n\n## Example\n\n    https://github.com/MortalFlesh/jasmine\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmortalflesh%2Fjasmine-data-provider","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmortalflesh%2Fjasmine-data-provider","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmortalflesh%2Fjasmine-data-provider/lists"}