MCPcopy
hub / github.com/sequelize/sequelize-auto / setupModels

Function setupModels

test/generate.test.js:27–56  ·  view source on GitHub ↗
(callback)

Source from the content-addressed store, hash-verified

25 });
26
27 function setupModels(callback) {
28 const config = self.sequelize.config;
29 const autoBin = path.join(__dirname, '..', 'bin', 'sequelize-auto');
30 try {
31 let execString = `node ${autoBin} -o "${testConfig.directory}" -d ${config.database} -h ${config.host}`;
32 if (_.has(config, 'username') && !_.isNull(config.username)) {
33 execString += ` -u ${config.username}`;
34 }
35 if (_.has(config, 'password') && config.password != null) {
36 execString += ` -x ${config.password}`;
37 }
38 if (_.has(config, 'port') && !_.isNull(config.port)) {
39 execString += ` -p ${config.port}`;
40 }
41 if (_.isString(self.sequelize.options.dialect)) {
42 execString += ` -e ${self.sequelize.options.dialect}`;
43 }
44 if (helpers.views) {
45 execString += ' -v'; // test view generation
46 }
47 // execString += ' -l es6'; // uncomment to test es6 file generation
48 if (helpers.isSnakeTables()) {
49 execString += ' --cm p --cf p'; // test PascalCase conversion from snake_case tables
50 }
51 debug('Starting child process:', execString);
52 exec(execString, callback);
53 } catch (err) {
54 callback(err);
55 }
56 };
57
58 describe('should be able to generate', function() {
59 it('the model files.', function(done) {

Callers 1

generate.test.jsFile · 0.70

Calls 1

isStringMethod · 0.80

Tested by

no test coverage detected