Skip to content

Instantly share code, notes, and snippets.

@rbartoli rbartoli/template.spec.js
Last active Jun 16, 2016

Embed
What would you like to do?
describe( 'Top level suite', function() {
describe( 'Second level test suite', function() {
before( function() {
// executes once, before all tests
} );
beforeEach( function() {
// executes before each test of the suite
} );
after( function() {
// executes once, after all tests
} );
afterEach( function() {
// executes after each test of the suite
} );
it( 'should verify a behavior', function() {
// a test containing assertions
} );
it('should verify an async behaviour', function() {
setTimeout(() => {
try {
// expect here
done()
} catch(e) {
done(e)
}
}, 100)
})
xit( 'should be a pending test', function() {
// this test is pending. All assertions inside are ignored.
} );
it.skip( 'should also be a pending test', function() {
// it.skip is a longer, more semantic form of xit
} );
it( 'should also be a pending test' );
} );
describe( 'Another second level test suite', function() {
} );
} );
describe( 'Maintainable unit test cases...', function( ) {
it( 'should test one type of behavior' );
it( 'should not depend on any other test cases.' );
it( 'should execute with exact same initial state as any other tests in the suite.' );
it( 'should not matter in which order are these tests executed.' );
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.