Created
March 1, 2018 13:16
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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