Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Change assert function for correct test cases #277

@diegonvs

Description

@diegonvs

I'm reviewing the tests on validators and i’ve saw a problem that the usage of assert.ok() is probably not adequate in our tests, maybe we can use assert.isTrue().

Taking this hypothesis:

	it('should validate any type', function() {
		const validator = validators.any();
		assert.ok(validator('testString'));
		assert.ok(validator(false));
		assert.ok(validator({}));
		assert.ok(validator(1));
		assert.ok(validator(function() {}));
		assert.ok(new Error(“something”));
	});

If validators.any() function is broken, these tests will pass no matter what that function returns (unless it returns false - which we never return). I suggest we change from assert.ok to assert.isTrue to verify cases that passes/corrects.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions