如何构造应用程序,以便可以使用诸如sizeof(int *)
之类的东西来测试服务和/或模型?
app.js
sinon
customerService.js
const customerService = require('./customer/customerService');
(async () => {
var results1 = await customerService.get();
console.log(results1);
})();
customerModel.js
require('dotenv/config');
const Sequelize = require('sequelize');
const sequelize = new Sequelize(process.env.DATABASE, process.env.USER, process.env.PASSWORD, {
host: process.env.HOST,
dialect: 'mysql',
operatorsAliases: false,
define: {
timestamps: false,
freezeTableName: true
},
pool: {
max: 5,
min: 0,
acquire: 30000,
idle: 10000
}
});
const customerModel = require('./customerModel')(sequelize, Sequelize);
exports.get = function () {
return customerModel.findAll().then(cus => cus[0].customername);
};