不要怂,就是干,撸起袖子干!

Commit 40e0769e by Jan Aagaard Meier

Tell istanbul to ignore abstract method in abstract query generator. https://git…

…hub.com/gotwarlost/istanbul/blob/master/ignoring-code-for-coverage.md
1 parent e56eabef
Showing with 23 additions and 1 deletions
...@@ -38,6 +38,7 @@ module.exports = (function() { ...@@ -38,6 +38,7 @@ module.exports = (function() {
- options: An object with options. - options: An object with options.
Defaults: { engine: 'InnoDB', charset: null } Defaults: { engine: 'InnoDB', charset: null }
*/ */
/* istanbul ignore next */
createTableQuery: function(tableName, attributes, options) { createTableQuery: function(tableName, attributes, options) {
throwMethodUndefined('createTableQuery'); throwMethodUndefined('createTableQuery');
}, },
...@@ -86,6 +87,7 @@ module.exports = (function() { ...@@ -86,6 +87,7 @@ module.exports = (function() {
/* /*
Returns a query, which gets all available table names in the database. Returns a query, which gets all available table names in the database.
*/ */
/* istanbul ignore next */
showTablesQuery: function() { showTablesQuery: function() {
throwMethodUndefined('showTablesQuery'); throwMethodUndefined('showTablesQuery');
}, },
...@@ -101,6 +103,7 @@ module.exports = (function() { ...@@ -101,6 +103,7 @@ module.exports = (function() {
- defaultValue: A String with the default value - defaultValue: A String with the default value
- allowNull: Boolean - allowNull: Boolean
*/ */
/* istanbul ignore next */
addColumnQuery: function(tableName, attributes) { addColumnQuery: function(tableName, attributes) {
throwMethodUndefined('addColumnQuery'); throwMethodUndefined('addColumnQuery');
}, },
...@@ -111,6 +114,7 @@ module.exports = (function() { ...@@ -111,6 +114,7 @@ module.exports = (function() {
- tableName: Name of the existing table - tableName: Name of the existing table
- attributeName: Name of the obsolete attribute. - attributeName: Name of the obsolete attribute.
*/ */
/* istanbul ignore next */
removeColumnQuery: function(tableName, attributeName) { removeColumnQuery: function(tableName, attributeName) {
throwMethodUndefined('removeColumnQuery'); throwMethodUndefined('removeColumnQuery');
}, },
...@@ -126,6 +130,7 @@ module.exports = (function() { ...@@ -126,6 +130,7 @@ module.exports = (function() {
- defaultValue: A String with the default value - defaultValue: A String with the default value
- allowNull: Boolean - allowNull: Boolean
*/ */
/* istanbul ignore next */
changeColumnQuery: function(tableName, attributes) { changeColumnQuery: function(tableName, attributes) {
throwMethodUndefined('changeColumnQuery'); throwMethodUndefined('changeColumnQuery');
}, },
...@@ -137,6 +142,7 @@ module.exports = (function() { ...@@ -137,6 +142,7 @@ module.exports = (function() {
- attrNameBefore: The name of the attribute, which shall be renamed. - attrNameBefore: The name of the attribute, which shall be renamed.
- attrNameAfter: The name of the attribute, after renaming. - attrNameAfter: The name of the attribute, after renaming.
*/ */
/* istanbul ignore next */
renameColumnQuery: function(tableName, attrNameBefore, attrNameAfter) { renameColumnQuery: function(tableName, attrNameBefore, attrNameAfter) {
throwMethodUndefined('renameColumnQuery'); throwMethodUndefined('renameColumnQuery');
}, },
...@@ -210,6 +216,7 @@ module.exports = (function() { ...@@ -210,6 +216,7 @@ module.exports = (function() {
Returns an insert into command for multiple values. Returns an insert into command for multiple values.
Parameters: table name + list of hashes of attribute-value-pairs. Parameters: table name + list of hashes of attribute-value-pairs.
*/ */
/* istanbul ignore next */
bulkInsertQuery: function(tableName, attrValueHashes) { bulkInsertQuery: function(tableName, attrValueHashes) {
throwMethodUndefined('bulkInsertQuery'); throwMethodUndefined('bulkInsertQuery');
}, },
...@@ -272,6 +279,7 @@ module.exports = (function() { ...@@ -272,6 +279,7 @@ module.exports = (function() {
(@see http://dev.mysql.com/doc/refman/5.6/en/truncate-table.html). (@see http://dev.mysql.com/doc/refman/5.6/en/truncate-table.html).
Note that truncate must ignore limit and where Note that truncate must ignore limit and where
*/ */
/* istanbul ignore next */
deleteQuery: function(tableName, where, options) { deleteQuery: function(tableName, where, options) {
throwMethodUndefined('deleteQuery'); throwMethodUndefined('deleteQuery');
}, },
...@@ -408,6 +416,7 @@ module.exports = (function() { ...@@ -408,6 +416,7 @@ module.exports = (function() {
- options: - options:
- database: Name of the database. - database: Name of the database.
*/ */
/* istanbul ignore next */
showIndexQuery: function(tableName, options) { showIndexQuery: function(tableName, options) {
throwMethodUndefined('showIndexQuery'); throwMethodUndefined('showIndexQuery');
}, },
...@@ -418,6 +427,7 @@ module.exports = (function() { ...@@ -418,6 +427,7 @@ module.exports = (function() {
- tableName: Name of an existing table. - tableName: Name of an existing table.
- indexNameOrAttributes: The name of the index as string or an array of attribute names. - indexNameOrAttributes: The name of the index as string or an array of attribute names.
*/ */
/* istanbul ignore next */
removeIndexQuery: function(tableName, indexNameOrAttributes) { removeIndexQuery: function(tableName, indexNameOrAttributes) {
throwMethodUndefined('removeIndexQuery'); throwMethodUndefined('removeIndexQuery');
}, },
...@@ -426,6 +436,7 @@ module.exports = (function() { ...@@ -426,6 +436,7 @@ module.exports = (function() {
This method transforms an array of attribute hashes into equivalent This method transforms an array of attribute hashes into equivalent
sql attribute definition. sql attribute definition.
*/ */
/* istanbul ignore next */
attributesToSQL: function(attributes) { attributesToSQL: function(attributes) {
throwMethodUndefined('attributesToSQL'); throwMethodUndefined('attributesToSQL');
}, },
...@@ -433,6 +444,7 @@ module.exports = (function() { ...@@ -433,6 +444,7 @@ module.exports = (function() {
/* /*
Returns all auto increment fields of a factory. Returns all auto increment fields of a factory.
*/ */
/* istanbul ignore next */
findAutoIncrementField: function(factory) { findAutoIncrementField: function(factory) {
throwMethodUndefined('findAutoIncrementField'); throwMethodUndefined('findAutoIncrementField');
}, },
...@@ -555,6 +567,7 @@ module.exports = (function() { ...@@ -555,6 +567,7 @@ module.exports = (function() {
/* /*
Create a trigger Create a trigger
*/ */
/* istanbul ignore next */
createTrigger: function(tableName, triggerName, timingType, fireOnArray, functionName, functionParams, createTrigger: function(tableName, triggerName, timingType, fireOnArray, functionName, functionParams,
optionsArray) { optionsArray) {
throwMethodUndefined('createTrigger'); throwMethodUndefined('createTrigger');
...@@ -563,13 +576,15 @@ module.exports = (function() { ...@@ -563,13 +576,15 @@ module.exports = (function() {
/* /*
Drop a trigger Drop a trigger
*/ */
/* istanbul ignore next */
dropTrigger: function(tableName, triggerName) { dropTrigger: function(tableName, triggerName) {
throwMethodUndefined('dropTrigger'); throwMethodUndefined('dropTrigger');
}, },
/* /*
Rename a trigger Rename a trigger
*/ */
/* istanbul ignore next */
renameTrigger: function(tableName, oldTriggerName, newTriggerName) { renameTrigger: function(tableName, oldTriggerName, newTriggerName) {
throwMethodUndefined('renameTrigger'); throwMethodUndefined('renameTrigger');
}, },
...@@ -577,6 +592,7 @@ module.exports = (function() { ...@@ -577,6 +592,7 @@ module.exports = (function() {
/* /*
Create a function Create a function
*/ */
/* istanbul ignore next */
createFunction: function(functionName, params, returnType, language, body, options) { createFunction: function(functionName, params, returnType, language, body, options) {
throwMethodUndefined('createFunction'); throwMethodUndefined('createFunction');
}, },
...@@ -584,6 +600,7 @@ module.exports = (function() { ...@@ -584,6 +600,7 @@ module.exports = (function() {
/* /*
Drop a function Drop a function
*/ */
/* istanbul ignore next */
dropFunction: function(functionName, params) { dropFunction: function(functionName, params) {
throwMethodUndefined('dropFunction'); throwMethodUndefined('dropFunction');
}, },
...@@ -591,6 +608,7 @@ module.exports = (function() { ...@@ -591,6 +608,7 @@ module.exports = (function() {
/* /*
Rename a function Rename a function
*/ */
/* istanbul ignore next */
renameFunction: function(oldFunctionName, params, newFunctionName) { renameFunction: function(oldFunctionName, params, newFunctionName) {
throwMethodUndefined('renameFunction'); throwMethodUndefined('renameFunction');
}, },
...@@ -598,6 +616,7 @@ module.exports = (function() { ...@@ -598,6 +616,7 @@ module.exports = (function() {
/* /*
Escape an identifier (e.g. a table or attribute name) Escape an identifier (e.g. a table or attribute name)
*/ */
/* istanbul ignore next */
quoteIdentifier: function(identifier, force) { quoteIdentifier: function(identifier, force) {
throwMethodUndefined('quoteIdentifier'); throwMethodUndefined('quoteIdentifier');
}, },
...@@ -632,6 +651,7 @@ module.exports = (function() { ...@@ -632,6 +651,7 @@ module.exports = (function() {
* @param {String} schemaName The name of the schema. * @param {String} schemaName The name of the schema.
* @return {String} The generated sql query. * @return {String} The generated sql query.
*/ */
/* istanbul ignore next */
getForeignKeysQuery: function(tableName, schemaName) { getForeignKeysQuery: function(tableName, schemaName) {
throwMethodUndefined('getForeignKeysQuery'); throwMethodUndefined('getForeignKeysQuery');
}, },
...@@ -643,6 +663,7 @@ module.exports = (function() { ...@@ -643,6 +663,7 @@ module.exports = (function() {
* @param {String} foreignKey The name of the foreign key constraint. * @param {String} foreignKey The name of the foreign key constraint.
* @return {String} The generated sql query. * @return {String} The generated sql query.
*/ */
/* istanbul ignore next */
dropForeignKeyQuery: function(tableName, foreignKey) { dropForeignKeyQuery: function(tableName, foreignKey) {
throwMethodUndefined('dropForeignKeyQuery'); throwMethodUndefined('dropForeignKeyQuery');
}, },
...@@ -1473,6 +1494,7 @@ module.exports = (function() { ...@@ -1473,6 +1494,7 @@ module.exports = (function() {
} }
}; };
/* istanbul ignore next */
var throwMethodUndefined = function(methodName) { var throwMethodUndefined = function(methodName) {
throw new Error('The method "' + methodName + '" is not defined! Please add it to your sql dialect.'); throw new Error('The method "' + methodName + '" is not defined! Please add it to your sql dialect.');
}; };
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!