const assert = require('assert');
const chai = require('chai');
const mocha = require('mocha');
const Try = require('../dist');

mocha.describe('Success', () => {

    mocha.describe('.filter()', () => {

        mocha.it('should return success when filter predicate matches', () => {
            let success = Try.success(100)
                .filter(value => value > 50);
            assert(success.isSuccess());
        });

        mocha.it('should return failure when predicate does not match', () => {
            let success = Try.success(100)
                .filter(value => value > 500);
            assert(success.isFailure());
        });

        mocha.it('should throw error when function argument is not present', () => {
            let success = Try.success(100);
            assert.throws(() => success.filter());
        });

        mocha.it('should throw error when function argument is not a function', () => {
            let success = Try.success(100);
            assert.throws(() => success.filter({}), Error);
        });

    });
});
@@ -1039,23 +1039,637 @@
        %7D);%0A%0A
+    %7D);%0A%0A    mocha.describe('.flapMap()', () =%3E %7B%0A%0A        mocha.it('should flat map success try value', () =%3E %7B%0A            let success = Try.success(100)%0A                .flatMap(value =%3E Try.success(value + 10));%0A            assert(success.isSuccess());%0A            assert.equal(success.value, 110);%0A        %7D);%0A%0A        mocha.it('should not flat map failure try value', () =%3E %7B%0A            let failure = Try.success(100)%0A                .flatMap(value =%3E Try.failure('Something went wrong'));%0A            assert(failure.isFailure());%0A            assert.equal(failure.err, 'Something went wrong');%0A        %7D);%0A%0A
     %7D);%0A%7D);

Add test for success flapMap.