-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also renames table_name to tableName for consistency between options and to not encourage snake case
- Loading branch information
Showing
10 changed files
with
73 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ tape('::init - generate SQL to create a table if none exists', function (t) { | |
|
||
tape('::select - generate SQL to select columns from a table', function (t) { | ||
var query = sqlGen.select({ | ||
tableName: schema.table_name, | ||
tableName: schema.tableName, | ||
select: ['email', 'dob'] | ||
}); | ||
|
||
|
@@ -44,7 +44,7 @@ tape('::select - generate SQL to select columns from a table', function (t) { | |
|
||
tape('::select - gen. SQL to select cols from table w/ where', function (t) { | ||
var query = sqlGen.select({ | ||
tableName: schema.table_name, | ||
tableName: schema.tableName, | ||
select: ['email', 'dob'], | ||
where: { foo: 'bar' } | ||
}); | ||
|
@@ -60,7 +60,7 @@ tape('::select - gen. SQL to select cols from table w/ where', function (t) { | |
|
||
tape('::insert - generate SQL to insert a column into a table', function (t) { | ||
var query = sqlGen.insert( | ||
{ tableName: schema.table_name, fields: { email: '[email protected]' } } | ||
{ tableName: schema.tableName, fields: { email: '[email protected]' } } | ||
); | ||
|
||
t.equal( | ||
|
@@ -77,7 +77,7 @@ tape('::insert - generate SQL to insert a column into a table', function (t) { | |
}); | ||
|
||
tape('::insert - generate SQL to insert blank col into table', function (t) { | ||
var query = sqlGen.insert({ tableName: schema.table_name }); | ||
var query = sqlGen.insert({ tableName: schema.tableName }); | ||
|
||
t.equal( | ||
query[0], | ||
|
@@ -94,7 +94,7 @@ tape('::insert - generate SQL to insert blank col into table', function (t) { | |
|
||
tape('::update - generate SQL to update a column in a table', function (t) { | ||
var query = sqlGen.update({ | ||
tableName: schema.table_name, | ||
tableName: schema.tableName, | ||
fields: { email: '[email protected]' } | ||
}); | ||
|
||
|
@@ -112,7 +112,7 @@ tape('::update - generate SQL to update a column in a table', function (t) { | |
}); | ||
|
||
tape('::update - generate SQL to update no fields of column', function (t) { | ||
var query = sqlGen.update({ tableName: schema.table_name }); | ||
var query = sqlGen.update({ tableName: schema.tableName }); | ||
|
||
t.equal( | ||
query[0], | ||
|
@@ -129,7 +129,7 @@ tape('::update - generate SQL to update no fields of column', function (t) { | |
|
||
tape('::update - gen. SQL to update a col in table w/ where', function (t) { | ||
var query = sqlGen.update({ | ||
tableName: schema.table_name, | ||
tableName: schema.tableName, | ||
fields: { email: '[email protected]' }, | ||
where: { foo: 'bar' } | ||
}); | ||
|
@@ -149,7 +149,7 @@ tape('::update - gen. SQL to update a col in table w/ where', function (t) { | |
|
||
tape('::delete should generate SQL to delete a row from a table', function (t) { | ||
var query = sqlGen.delete({ | ||
tableName: schema.table_name, | ||
tableName: schema.tableName, | ||
where: { username: 'bob' } | ||
}); | ||
|
||
|
@@ -168,7 +168,7 @@ tape('::delete should generate SQL to delete a row from a table', function (t) { | |
|
||
tape('::delete should gen SQL to delete row w/ multiple where', function (t) { | ||
var query = sqlGen.delete({ | ||
tableName: schema.table_name, | ||
tableName: schema.tableName, | ||
where: { username: 'bob', dob: '20/04/1988' } | ||
}); | ||
|
||
|
@@ -184,3 +184,14 @@ tape('::delete should gen SQL to delete row w/ multiple where', function (t) { | |
); | ||
t.end(); | ||
}); | ||
|
||
tape('::dropTable should gen SQL to drop table', function (t) { | ||
var query = sqlGen.dropTable({ tableName: schema.tableName }); | ||
|
||
t.equal( | ||
query, | ||
'DROP TABLE "user_data";', | ||
'Generate parameterised query' | ||
); | ||
t.end(); | ||
}); |