# mocha/jasmine snippets

- trigger: bdescribe
  description: "mocha/jasmine describe"
  scope: javascript
  text: |
        describe('${1:description}', function () {
            ${2:}
        });

- trigger: bit
  description: "mocha/jasmine test (synchronous)"
  scope: javascript
  text: |
        it('${1:should}', function () {
            ${2:}
        });
         
- trigger: bait
  description: "asynchornous mocha/jasmine test"
  scope: javascript
  text: |
        it('${1:should}', function (done) {
            ${2:}
        });
            
- trigger: bbeforeEach
  description: "mocha/jasmine before-each-test"
  scope: javascript
  text: |
        beforeEach(function () {
            ${1:}
        });
        
- trigger: bafterEach
  description: "mocha/jasmine after-each-test"
  scope: javascript
  text: |
        afterEach(function () {
            ${1:}
        });
        
- trigger: bdone
  description: ".then(done, done) - tail of async promise chain"
  scope: javascript
  text: |
        .then(done, done);
        ${1:}
        
# chai expectation snippets
# see http://chaijs.com/api/bdd/

- trigger: bexpect
  description: "chai expect"
  scope: javascript
  text: |
        expect(${1:expected}).to.${2:};

- trigger: bequal
  description: "chai expect to equal"
  scope: javascript
  text: |
        expect(${1:expected}).to.equal(${2:value});
        
- trigger: blen
  description: "chai expect to have length"
  scope: javascript
  text: |
        expect(${1:expected}).to.have.length(${2:length});
        
- trigger: bmatch
  description: "chai expect to match"
  scope: javascript
  text: |
        expect(${1:expected}).to.match(/${2:match}/i);
        
        
- trigger: bprop
  description: "chai expect to have property"
  scope: javascript
  text: |
        expect(${1:expected}).to.have.property('${2:property}', ${3:value});
        
- trigger: bcalled
  description: "chai expect to have been called"
  scope: javascript
  text: |
        expect(${1:expected}).to.have.been.called${2:}; 

- trigger: bthrow
  description: "chai expect to throw"
  scope: javascript
  text: |
        expect(function () {
            ${1:fn-that-throws};
        }).to.throw(${2:Error}); 
  
# bard.js snippets

- trigger: binject
  description: "bard inject"
  scope: javascript
  text: |
        bard.inject(this, ${1:quoted-dependencies});
        
- trigger: bcinject
  description: "bard inject controller"
  scope: javascript
  text: |
        bard.inject(this, '$controller', '$q', '$rootScope', ${1:});
        
- trigger: bmodule
  description: "bard app module"
  scope: javascript
  text: |
        bard.appModule('${1:app}'${2:});
      
- trigger: basyncmodule
  description: "bard async module"
  scope: javascript
  text: |
        bard.asyncModule('${1:app}'${2:});
        
- trigger: bverify
  description: "bard.verifyNoOutstandingHttpRequests();"
  scope: javascript
  text: |
        bard.verifyNoOutstandingHttpRequests();
        ${1:}
  
# angular test snippets

- trigger: bapply
  description: "$rootScope.$apply();"
  scope: javascript
  text: |
        $rootScope.$apply();
        ${1:}  

- trigger: bwhen
  description: "$httpBackend.when(...).respond(...);"
  scope: javascript
  text: |
        $httpBackend.when('get', '${1:url}')
                    .respond(${2:status}, {${3:data}});

- trigger: bflush
  description: "$httpBackend.flush();"
  scope: javascript
  text: |
        $httpBackend.flush();
        ${1:} 
  
# miscellaneous snippets
- trigger: bfn
  description: "function template"
  scope: javascript
  text: |
        function ${1:}() {
            ${2:}
        }
