任何人都可以告诉我以下Jasmine代码的区别,请原谅我,如果它是愚蠢的
describe('Testing a Hello World controller', function() {
var $scope;
beforeEach(function(){
$scope = 'Hello World'
});
it('should say hello to the World', function() {
expect($scope).toEqual('Hello World');
});
});
和
describe('Testing a Hello World controller', function() {
var $scope = 'Hello World';
it('should say hello to the World', function() {
expect($scope).toEqual('Hello World');
});
});
答案 0 :(得分:0)
没有,因为你在每个描述中只有一个测试,试试这个:
describe('beforeEach example', function() {
var $scope = 0;
beforeEach(function(){
$scope += 1
});
it('should be 1', function() {
expect($scope).toEqual(1);
});
it('should be 2', function() {
expect($scope).toEqual(2);
});
});