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

Commit 9b61b5a2 by Jan Aagaard Meier

feat(datatypes) Show the correct link in warning message. Remove a couple of unused vars.

Fix a couple of datatypes related unit tests
1 parent 7a8a1e70
...@@ -52,8 +52,8 @@ ABSTRACT.prototype.toString = function(options) { ...@@ -52,8 +52,8 @@ ABSTRACT.prototype.toString = function(options) {
ABSTRACT.prototype.toSql = function() { ABSTRACT.prototype.toSql = function() {
return this.key; return this.key;
}; };
ABSTRACT.prototype.warn = function(text) { ABSTRACT.warn = function(link, text) {
deprecate(text + '\n>> Check: ' + this.dialectTypes); deprecate(text + '\n>> Check: ' + link);
}; };
ABSTRACT.prototype.stringify = function (value, options) { ABSTRACT.prototype.stringify = function (value, options) {
if (this.$stringify) { if (this.$stringify) {
...@@ -156,6 +156,7 @@ var TEXT = ABSTRACT.inherits(function(length) { ...@@ -156,6 +156,7 @@ var TEXT = ABSTRACT.inherits(function(length) {
length: length length: length
}; };
if (!(this instanceof TEXT)) return new TEXT(options); if (!(this instanceof TEXT)) return new TEXT(options);
this.options = options;
this._length = options.length || ''; this._length = options.length || '';
}); });
...@@ -529,6 +530,7 @@ var BLOB = ABSTRACT.inherits(function(length) { ...@@ -529,6 +530,7 @@ var BLOB = ABSTRACT.inherits(function(length) {
length: length length: length
}; };
if (!(this instanceof BLOB)) return new BLOB(options); if (!(this instanceof BLOB)) return new BLOB(options);
this.options = options;
this._length = options.length || ''; this._length = options.length || '';
}); });
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
var _ = require('lodash'); var _ = require('lodash');
module.exports = function (BaseTypes) { module.exports = function (BaseTypes) {
BaseTypes.ABSTRACT.prototype.dialectTypes = 'https://msdn.microsoft.com/en-us/library/ms187752%28v=sql.110%29.aspx'; var warn = BaseTypes.ABSTRACT.warn.bind(undefined, 'https://msdn.microsoft.com/en-us/library/ms187752%28v=sql.110%29.aspx');
BaseTypes.DATE.types.mssql = [42]; BaseTypes.DATE.types.mssql = [42];
BaseTypes.STRING.types.mssql = [231, 173]; BaseTypes.STRING.types.mssql = [231, 173];
...@@ -29,10 +29,10 @@ module.exports = function (BaseTypes) { ...@@ -29,10 +29,10 @@ module.exports = function (BaseTypes) {
BLOB.prototype.toSql = function() { BLOB.prototype.toSql = function() {
if (this._length) { if (this._length) {
if (this._length.toLowerCase() === 'tiny') { // tiny = 2^8 if (this._length.toLowerCase() === 'tiny') { // tiny = 2^8
this.warn('MSSQL does not support BLOB with the `length` = `tiny` option. `VARBINARY(256)` will be used instead.'); warn('MSSQL does not support BLOB with the `length` = `tiny` option. `VARBINARY(256)` will be used instead.');
return 'VARBINARY(256)'; return 'VARBINARY(256)';
} }
this.warn('MSSQL does not support BLOB with the `length` option. `VARBINARY(MAX)` will be used instead.'); warn('MSSQL does not support BLOB with the `length` option. `VARBINARY(MAX)` will be used instead.');
} }
return 'VARBINARY(MAX)'; return 'VARBINARY(MAX)';
}; };
...@@ -67,10 +67,10 @@ module.exports = function (BaseTypes) { ...@@ -67,10 +67,10 @@ module.exports = function (BaseTypes) {
// Using unicode is just future proof // Using unicode is just future proof
if (this._length) { if (this._length) {
if (this._length.toLowerCase() === 'tiny') { // tiny = 2^8 if (this._length.toLowerCase() === 'tiny') { // tiny = 2^8
this.warn('MSSQL does not support TEXT with the `length` = `tiny` option. `NVARCHAR(256)` will be used instead.'); warn('MSSQL does not support TEXT with the `length` = `tiny` option. `NVARCHAR(256)` will be used instead.');
return 'NVARCHAR(256)'; return 'NVARCHAR(256)';
} }
this.warn('MSSQL does not support TEXT with the `length` option. `NVARCHAR(MAX)` will be used instead.'); warn('MSSQL does not support TEXT with the `length` option. `NVARCHAR(MAX)` will be used instead.');
} }
return 'NVARCHAR(MAX)'; return 'NVARCHAR(MAX)';
}; };
...@@ -105,7 +105,7 @@ module.exports = function (BaseTypes) { ...@@ -105,7 +105,7 @@ module.exports = function (BaseTypes) {
// MSSQL does not support any options for integer // MSSQL does not support any options for integer
if (this._length || this.options.length || this._unsigned || this._zerofill) { if (this._length || this.options.length || this._unsigned || this._zerofill) {
this.warn('MSSQL does not support INTEGER with options. Plain `INTEGER` will be used instead.'); warn('MSSQL does not support INTEGER with options. Plain `INTEGER` will be used instead.');
this._length = undefined; this._length = undefined;
this.options.length = undefined; this.options.length = undefined;
this._unsigned = undefined; this._unsigned = undefined;
...@@ -119,7 +119,7 @@ module.exports = function (BaseTypes) { ...@@ -119,7 +119,7 @@ module.exports = function (BaseTypes) {
// MSSQL does not support any options for bigint // MSSQL does not support any options for bigint
if (this._length || this.options.length || this._unsigned || this._zerofill) { if (this._length || this.options.length || this._unsigned || this._zerofill) {
this.warn('MSSQL does not support BIGINT with options. Plain `BIGINT` will be used instead.'); warn('MSSQL does not support BIGINT with options. Plain `BIGINT` will be used instead.');
this._length = undefined; this._length = undefined;
this.options.length = undefined; this.options.length = undefined;
this._unsigned = undefined; this._unsigned = undefined;
...@@ -133,7 +133,7 @@ module.exports = function (BaseTypes) { ...@@ -133,7 +133,7 @@ module.exports = function (BaseTypes) {
// MSSQL does not support any options for real // MSSQL does not support any options for real
if (this._length || this.options.length || this._unsigned || this._zerofill) { if (this._length || this.options.length || this._unsigned || this._zerofill) {
this.warn('MSSQL does not support REAL with options. Plain `REAL` will be used instead.'); warn('MSSQL does not support REAL with options. Plain `REAL` will be used instead.');
this._length = undefined; this._length = undefined;
this.options.length = undefined; this.options.length = undefined;
this._unsigned = undefined; this._unsigned = undefined;
...@@ -150,16 +150,16 @@ module.exports = function (BaseTypes) { ...@@ -150,16 +150,16 @@ module.exports = function (BaseTypes) {
// Values between 25-53 result in 15 digits precision (8 bytes storage size) // Values between 25-53 result in 15 digits precision (8 bytes storage size)
// If decimals are provided remove these and print a warning // If decimals are provided remove these and print a warning
if (this._decimals) { if (this._decimals) {
this.warn('MSSQL does not support Float with decimals. Plain `FLOAT` will be used instead.'); warn('MSSQL does not support Float with decimals. Plain `FLOAT` will be used instead.');
this._length = undefined; this._length = undefined;
this.options.length = undefined; this.options.length = undefined;
} }
if (this._unsigned) { if (this._unsigned) {
this.warn('MSSQL does not support Float unsigned. `UNSIGNED` was removed.'); warn('MSSQL does not support Float unsigned. `UNSIGNED` was removed.');
this._unsigned = undefined; this._unsigned = undefined;
} }
if (this._zerofill) { if (this._zerofill) {
this.warn('MSSQL does not support Float zerofill. `ZEROFILL` was removed.'); warn('MSSQL does not support Float zerofill. `ZEROFILL` was removed.');
this._zerofill = undefined; this._zerofill = undefined;
} }
}); });
......
...@@ -52,11 +52,11 @@ module.exports = function (BaseTypes) { ...@@ -52,11 +52,11 @@ module.exports = function (BaseTypes) {
}); });
GEOMETRY.parse = GEOMETRY.prototype.parse = function(value) { GEOMETRY.parse = GEOMETRY.prototype.parse = function(value) {
// For some reason, discard the first 4 bytes // For some reason, discard the first 4 bytes
value = value.buffer().slice(4); value = value.buffer().slice(4);
return wkx.Geometry.parse(value).toGeoJSON(); return wkx.Geometry.parse(value).toGeoJSON();
}; };
GEOMETRY.prototype.toSql = function() { GEOMETRY.prototype.toSql = function() {
return this.sqlType; return this.sqlType;
......
'use strict'; 'use strict';
var Utils = require('../../utils') var Utils = require('../../utils');
, DataTypes = require('../../data-types')
, SqlString = require('../../sql-string')
, Wkt = require('wellknown');
var QueryGenerator = { var QueryGenerator = {
dialect: 'mysql', dialect: 'mysql',
......
...@@ -7,13 +7,7 @@ var _ = require('lodash') ...@@ -7,13 +7,7 @@ var _ = require('lodash')
, hstore = require('./hstore'); , hstore = require('./hstore');
module.exports = function (BaseTypes) { module.exports = function (BaseTypes) {
BaseTypes.ABSTRACT.prototype.dialectTypes = 'http://www.postgresql.org/docs/9.4/static/datatype.html'; var warn = BaseTypes.ABSTRACT.warn.bind(undefined, 'http://www.postgresql.org/docs/9.4/static/datatype.html');
// numeric
BaseTypes.DECIMAL.types.postgres = {
oids: [1700],
array_oids: [1231]
};
BaseTypes.UUID.types.postgres = { BaseTypes.UUID.types.postgres = {
oids: [2950], oids: [2950],
...@@ -40,6 +34,18 @@ module.exports = function (BaseTypes) { ...@@ -40,6 +34,18 @@ module.exports = function (BaseTypes) {
array_oids: [1183] array_oids: [1183]
}; };
var DECIMAL = BaseTypes.DECIMAL.inherits();
DECIMAL.parse = function (value) {
return parseFloat(value);
};
// numeric
BaseTypes.DECIMAL.types.postgres = {
oids: [1700],
array_oids: [1231]
};
var STRING = BaseTypes.STRING.inherits(); var STRING = BaseTypes.STRING.inherits();
STRING.prototype.toSql = function () { STRING.prototype.toSql = function () {
if (this._binary) { if (this._binary) {
...@@ -57,7 +63,7 @@ module.exports = function (BaseTypes) { ...@@ -57,7 +63,7 @@ module.exports = function (BaseTypes) {
TEXT.prototype.toSql = function() { TEXT.prototype.toSql = function() {
if (this._length) { if (this._length) {
this.warn('PostgreSQL does not support TEXT with options. Plain `TEXT` will be used instead.'); warn('PostgreSQL does not support TEXT with options. Plain `TEXT` will be used instead.');
this._length = undefined; this._length = undefined;
} }
return 'TEXT'; return 'TEXT';
...@@ -110,7 +116,7 @@ module.exports = function (BaseTypes) { ...@@ -110,7 +116,7 @@ module.exports = function (BaseTypes) {
// POSTGRES does not support any parameters for integer // POSTGRES does not support any parameters for integer
if (this._length || this.options.length || this._unsigned || this._zerofill) { if (this._length || this.options.length || this._unsigned || this._zerofill) {
this.warn('PostgreSQL does not support INTEGER with options. Plain `INTEGER` will be used instead.'); warn('PostgreSQL does not support INTEGER with options. Plain `INTEGER` will be used instead.');
this._length = undefined; this._length = undefined;
this.options.length = undefined; this.options.length = undefined;
this._unsigned = undefined; this._unsigned = undefined;
...@@ -134,7 +140,7 @@ module.exports = function (BaseTypes) { ...@@ -134,7 +140,7 @@ module.exports = function (BaseTypes) {
// POSTGRES does not support any parameters for bigint // POSTGRES does not support any parameters for bigint
if (this._length || this.options.length || this._unsigned || this._zerofill) { if (this._length || this.options.length || this._unsigned || this._zerofill) {
this.warn('PostgreSQL does not support BIGINT with options. Plain `BIGINT` will be used instead.'); warn('PostgreSQL does not support BIGINT with options. Plain `BIGINT` will be used instead.');
this._length = undefined; this._length = undefined;
this.options.length = undefined; this.options.length = undefined;
this._unsigned = undefined; this._unsigned = undefined;
...@@ -154,7 +160,7 @@ module.exports = function (BaseTypes) { ...@@ -154,7 +160,7 @@ module.exports = function (BaseTypes) {
// POSTGRES does not support any parameters for real // POSTGRES does not support any parameters for real
if (this._length || this.options.length || this._unsigned || this._zerofill) { if (this._length || this.options.length || this._unsigned || this._zerofill) {
this.warn('PostgreSQL does not support REAL with options. Plain `REAL` will be used instead.'); warn('PostgreSQL does not support REAL with options. Plain `REAL` will be used instead.');
this._length = undefined; this._length = undefined;
this.options.length = undefined; this.options.length = undefined;
this._unsigned = undefined; this._unsigned = undefined;
...@@ -174,7 +180,7 @@ module.exports = function (BaseTypes) { ...@@ -174,7 +180,7 @@ module.exports = function (BaseTypes) {
// POSTGRES does not support any parameters for double // POSTGRES does not support any parameters for double
if (this._length || this.options.length || this._unsigned || this._zerofill) { if (this._length || this.options.length || this._unsigned || this._zerofill) {
this.warn('PostgreSQL does not support DOUBLE with options. Plain `DOUBLE` will be used instead.'); warn('PostgreSQL does not support DOUBLE with options. Plain `DOUBLE` will be used instead.');
this._length = undefined; this._length = undefined;
this.options.length = undefined; this.options.length = undefined;
this._unsigned = undefined; this._unsigned = undefined;
...@@ -197,17 +203,17 @@ module.exports = function (BaseTypes) { ...@@ -197,17 +203,17 @@ module.exports = function (BaseTypes) {
// Values between 25-53 result in DOUBLE PRECISION // Values between 25-53 result in DOUBLE PRECISION
// If decimals are provided remove these and print a warning // If decimals are provided remove these and print a warning
if (this._decimals) { if (this._decimals) {
this.warn('PostgreSQL does not support FLOAT with decimals. Plain `FLOAT` will be used instead.'); warn('PostgreSQL does not support FLOAT with decimals. Plain `FLOAT` will be used instead.');
this._length = undefined; this._length = undefined;
this.options.length = undefined; this.options.length = undefined;
this._decimals = undefined; this._decimals = undefined;
} }
if (this._unsigned) { if (this._unsigned) {
this.warn('PostgreSQL does not support FLOAT unsigned. `UNSIGNED` was removed.'); warn('PostgreSQL does not support FLOAT unsigned. `UNSIGNED` was removed.');
this._unsigned = undefined; this._unsigned = undefined;
} }
if (this._zerofill) { if (this._zerofill) {
this.warn('PostgreSQL does not support FLOAT zerofill. `ZEROFILL` was removed.'); warn('PostgreSQL does not support FLOAT zerofill. `ZEROFILL` was removed.');
this._zerofill = undefined; this._zerofill = undefined;
} }
}); });
...@@ -216,7 +222,7 @@ module.exports = function (BaseTypes) { ...@@ -216,7 +222,7 @@ module.exports = function (BaseTypes) {
BLOB.prototype.toSql = function() { BLOB.prototype.toSql = function() {
if (this._length) { if (this._length) {
this.warn('PostgreSQL does not support BLOB (BYTEA) with options. Plain `BYTEA` will be used instead.'); warn('PostgreSQL does not support BLOB (BYTEA) with options. Plain `BYTEA` will be used instead.');
this._length = undefined; this._length = undefined;
} }
return 'BYTEA'; return 'BYTEA';
...@@ -340,6 +346,7 @@ module.exports = function (BaseTypes) { ...@@ -340,6 +346,7 @@ module.exports = function (BaseTypes) {
}; };
var exports = { var exports = {
DECIMAL: DECIMAL,
BLOB: BLOB, BLOB: BLOB,
STRING: STRING, STRING: STRING,
CHAR: CHAR, CHAR: CHAR,
......
...@@ -2,11 +2,8 @@ ...@@ -2,11 +2,8 @@
/* jshint -W110 */ /* jshint -W110 */
var Utils = require('../../utils') var Utils = require('../../utils')
, hstore = require('./hstore')
, range = require('./range')
, util = require('util') , util = require('util')
, DataTypes = require('../../data-types') , DataTypes = require('../../data-types')
, SqlString = require('../../sql-string')
, AbstractQueryGenerator = require('../abstract/query-generator') , AbstractQueryGenerator = require('../abstract/query-generator')
, primaryKeys = {} , primaryKeys = {}
, _ = require('lodash'); , _ = require('lodash');
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
var _ = require('lodash'); var _ = require('lodash');
module.exports = function (BaseTypes) { module.exports = function (BaseTypes) {
BaseTypes.ABSTRACT.prototype.dialectTypes = 'https://www.sqlite.org/datatype3.html'; var warn = BaseTypes.ABSTRACT.warn.bind(undefined, 'https://www.sqlite.org/datatype3.html');
BaseTypes.DATE.types.sqlite = ['DATETIME']; BaseTypes.DATE.types.sqlite = ['DATETIME'];
BaseTypes.STRING.types.sqlite = ['VARCHAR', 'VARCHAR BINARY']; BaseTypes.STRING.types.sqlite = ['VARCHAR', 'VARCHAR BINARY'];
...@@ -45,7 +45,7 @@ module.exports = function (BaseTypes) { ...@@ -45,7 +45,7 @@ module.exports = function (BaseTypes) {
var TEXT = BaseTypes.TEXT.inherits(); var TEXT = BaseTypes.TEXT.inherits();
TEXT.prototype.toSql = function() { TEXT.prototype.toSql = function() {
if (this._length) { if (this._length) {
this.warn('SQLite does not support TEXT with options. Plain `TEXT` will be used instead.'); warn('SQLite does not support TEXT with options. Plain `TEXT` will be used instead.');
this._length = undefined; this._length = undefined;
} }
return 'TEXT'; return 'TEXT';
...@@ -86,7 +86,7 @@ module.exports = function (BaseTypes) { ...@@ -86,7 +86,7 @@ module.exports = function (BaseTypes) {
length: length length: length
}; };
if (!(this instanceof INTEGER)) return new INTEGER(options); if (!(this instanceof INTEGER)) return new INTEGER(options);
NUMBER.call(this, options); BaseTypes.INTEGER.call(this, options);
}); });
INTEGER.prototype.key = INTEGER.key = 'INTEGER'; INTEGER.prototype.key = INTEGER.key = 'INTEGER';
INTEGER.prototype.toSql = function() { INTEGER.prototype.toSql = function() {
...@@ -98,7 +98,7 @@ module.exports = function (BaseTypes) { ...@@ -98,7 +98,7 @@ module.exports = function (BaseTypes) {
length: length length: length
}; };
if (!(this instanceof BIGINT)) return new BIGINT(options); if (!(this instanceof BIGINT)) return new BIGINT(options);
NUMBER.call(this, options); BaseTypes.BIGINT.call(this, options);
}); });
BIGINT.prototype.key = BIGINT.key = 'BIGINT'; BIGINT.prototype.key = BIGINT.key = 'BIGINT';
BIGINT.prototype.toSql = function() { BIGINT.prototype.toSql = function() {
...@@ -111,7 +111,7 @@ module.exports = function (BaseTypes) { ...@@ -111,7 +111,7 @@ module.exports = function (BaseTypes) {
decimals: decimals decimals: decimals
}; };
if (!(this instanceof FLOAT)) return new FLOAT(options); if (!(this instanceof FLOAT)) return new FLOAT(options);
NUMBER.call(this, options); BaseTypes.FLOAT.call(this, options);
}); });
FLOAT.prototype.key = FLOAT.key = 'FLOAT'; FLOAT.prototype.key = FLOAT.key = 'FLOAT';
FLOAT.prototype.toSql = function() { FLOAT.prototype.toSql = function() {
...@@ -124,7 +124,7 @@ module.exports = function (BaseTypes) { ...@@ -124,7 +124,7 @@ module.exports = function (BaseTypes) {
decimals: decimals decimals: decimals
}; };
if (!(this instanceof DOUBLE)) return new DOUBLE(options); if (!(this instanceof DOUBLE)) return new DOUBLE(options);
NUMBER.call(this, options); BaseTypes.DOUBLE.call(this, options);
}); });
DOUBLE.prototype.key = DOUBLE.key = 'DOUBLE PRECISION'; DOUBLE.prototype.key = DOUBLE.key = 'DOUBLE PRECISION';
DOUBLE.prototype.toSql = function() { DOUBLE.prototype.toSql = function() {
...@@ -137,7 +137,7 @@ module.exports = function (BaseTypes) { ...@@ -137,7 +137,7 @@ module.exports = function (BaseTypes) {
decimals: decimals decimals: decimals
}; };
if (!(this instanceof REAL)) return new REAL(options); if (!(this instanceof REAL)) return new REAL(options);
NUMBER.call(this, options); BaseTypes.REAL.call(this, options);
}); });
REAL.prototype.key = REAL.key = 'REAL'; REAL.prototype.key = REAL.key = 'REAL';
REAL.prototype.toSql = function() { REAL.prototype.toSql = function() {
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
/* jshint -W110 */ /* jshint -W110 */
var Utils = require('../../utils') var Utils = require('../../utils')
, DataTypes = require('../../data-types')
, Transaction = require('../../transaction') , Transaction = require('../../transaction')
, _ = require('lodash'); , _ = require('lodash');
......
...@@ -34,6 +34,8 @@ describe(Support.getTestDialectTeaser('DataTypes'), function() { ...@@ -34,6 +34,8 @@ describe(Support.getTestDialectTeaser('DataTypes'), function() {
require('../../node_modules/pg/node_modules/pg-types/lib/textParsers').init(function (oid, converter) { require('../../node_modules/pg/node_modules/pg-types/lib/textParsers').init(function (oid, converter) {
types.setTypeParser(oid, 'text', converter); types.setTypeParser(oid, 'text', converter);
}); });
this.sequelize.connectionManager.refreshTypes(DataTypes.postgres); // Reload custom parsers for hstore and geometry
break; break;
default: default:
this.sequelize.connectionManager.$clearTypeParser(); this.sequelize.connectionManager.$clearTypeParser();
......
...@@ -658,9 +658,10 @@ if (dialect.match(/^postgres/)) { ...@@ -658,9 +658,10 @@ if (dialect.match(/^postgres/)) {
var period = [new Date(2015, 0, 1), new Date(2015, 11, 31)]; var period = [new Date(2015, 0, 1), new Date(2015, 11, 31)];
return this.User.create({ username: 'user', email: ['foo@bar.com'], course_period: period}).then(function(newUser) { return this.User.create({ username: 'user', email: ['foo@bar.com'], course_period: period}).then(function(newUser) {
// Check to see if the default value for a range field works // Check to see if the default value for a range field works
expect(newUser.acceptable_marks.length).to.equal(2); expect(newUser.acceptable_marks.length).to.equal(2);
expect(newUser.acceptable_marks[0]).to.equal('0.65'); // lower bound expect(newUser.acceptable_marks[0]).to.equal(0.65); // lower bound
expect(newUser.acceptable_marks[1]).to.equal('1'); // upper bound expect(newUser.acceptable_marks[1]).to.equal(1); // upper bound
expect(newUser.acceptable_marks.inclusive).to.deep.equal([false, false]); // not inclusive expect(newUser.acceptable_marks.inclusive).to.deep.equal([false, false]); // not inclusive
expect(newUser.course_period[0] instanceof Date).to.be.ok; // lower bound expect(newUser.course_period[0] instanceof Date).to.be.ok; // lower bound
expect(newUser.course_period[1] instanceof Date).to.be.ok; // upper bound expect(newUser.course_period[1] instanceof Date).to.be.ok; // upper bound
...@@ -731,8 +732,8 @@ if (dialect.match(/^postgres/)) { ...@@ -731,8 +732,8 @@ if (dialect.match(/^postgres/)) {
return User.create({ username: 'user', email: ['foo@bar.com'], course_period: period }).then(function(newUser) { return User.create({ username: 'user', email: ['foo@bar.com'], course_period: period }).then(function(newUser) {
// Check to see if the default value for a range field works // Check to see if the default value for a range field works
expect(newUser.acceptable_marks.length).to.equal(2); expect(newUser.acceptable_marks.length).to.equal(2);
expect(newUser.acceptable_marks[0]).to.equal('0.65'); // lower bound expect(newUser.acceptable_marks[0]).to.equal(0.65); // lower bound
expect(newUser.acceptable_marks[1]).to.equal('1'); // upper bound expect(newUser.acceptable_marks[1]).to.equal(1); // upper bound
expect(newUser.acceptable_marks.inclusive).to.deep.equal([false, false]); // not inclusive expect(newUser.acceptable_marks.inclusive).to.deep.equal([false, false]); // not inclusive
expect(newUser.course_period[0] instanceof Date).to.be.ok; expect(newUser.course_period[0] instanceof Date).to.be.ok;
expect(newUser.course_period[1] instanceof Date).to.be.ok; expect(newUser.course_period[1] instanceof Date).to.be.ok;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!