[FIX] Truffle contract has not been deployed to detected network

Whenever you're faced with such an issue there is something you're missing.To fix that add the contract to migrations inside the migration folder.

Migrations Folder

1_initial_migration.js
2_your_contract_migration.js
var YourContractName = artifacts.require("./YourContractName.sol");

module.exports = function(deployer) {
     deployer.deploy(YourContractName);
};

finally run 

truffle test