Skip to content
This repository has been archived by the owner on Apr 25, 2019. It is now read-only.

Commit

Permalink
Added extra tests to get 100% coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
roeldev committed Apr 18, 2015
1 parent a3e91c0 commit c381351
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ Confirge.replace = function($obj, $vars)
Confirge.extend = DeepExtend;

/*
Confirge - Flexible configuration!
Confirge
Copyright (c) 2015 Roel Schut (roelschut.nl)
This program is free software; you can redistribute it and/or modify
Expand Down
18 changes: 17 additions & 1 deletion test/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,16 @@ describe('Confirge.read()', function()
Assert.deepEqual($actual, EXPECTED_JSON);
});

it('should read the json file from the function, and return an object', function()
{
var $input = function()
{
return getFixtureFile('success.json');
};

Assert.deepEqual(Confirge.read($input), EXPECTED_JSON);
});

it('should fail reading the yaml file', function()
{
var $actual = Confirge.read( getFixtureFile('failure.yml') );
Expand Down Expand Up @@ -138,11 +148,17 @@ describe('Confirge.replace()', function()
});
});

it('should return the same object', function()
it('should return the same object [1]', function()
{
var $input = { 'str': 'do %not% replace %anything%!' };
Assert.deepEqual(Confirge.replace($input, INPUT_VARS), $input);
});

it('should return the same object [2]', function()
{
var $input = ['test', '123', function(){ return false }];
Assert.deepEqual(Confirge.replace($input, INPUT_VARS), $input);
})
});

//------------------------------------------------------------------------------
Expand Down

0 comments on commit c381351

Please sign in to comment.