Skip to content

Instantly share code, notes, and snippets.

@sinsunsan
Created March 1, 2018 13:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sinsunsan/cb1779b3b83a33fe8446bf27ef7f6149 to your computer and use it in GitHub Desktop.
Save sinsunsan/cb1779b3b83a33fe8446bf27ef7f6149 to your computer and use it in GitHub Desktop.
parametrized jasmine test / traduction of https://gist.github.com/basti1302/5051200 in javascript
describe("The suit", function() {
var parameterized;
beforeEach(function() {
return console.log('non-parameterized#beforeEach');
});
afterEach(function() {
return console.log('non-parameterized#afterEach');
});
it("should execute specs in the non-parameterized part", function() {
console.log('spec in non-parameterized');
return expect(true).toBe(true);
});
parameterized = function(param) {
return describe("The parameterized sub-suit (" + param + ")", function() {
beforeEach(function() {
return console.log('parameterized#beforeEach');
});
afterEach(function() {
return console.log('parameterized#afterEach');
});
it("should execute specs in the parameterized part", function() {
console.log('spec in parameterized');
return expect(true).toBe(true);
});
return it("should be parameterizable", function() {
console.log('parameter: ' + param);
return expect(param).toMatch(/[AB]/);
});
});
};
parameterized('A');
return parameterized('B');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment