Files
portfolio2023/node_modules/@adonisjs/lucid/build/src/Bindings/TestUtils.js
T
2023-11-24 22:35:41 +01:00

34 lines
1.0 KiB
JavaScript

"use strict";
/*
* @adonisjs/lucid
*
* (c) Harminder Virk <virk@adonisjs.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.defineTestUtils = void 0;
const Seeder_1 = require("../TestUtils/Seeder");
const Migration_1 = require("../TestUtils/Migration");
const Truncator_1 = require("../TestUtils/Truncator");
/**
* Define database testing utilities
*/
function defineTestUtils(testUtils, ace) {
testUtils.constructor.macro('db', (connectionName) => {
return {
migrate() {
return new Migration_1.TestsMigrator(ace, connectionName).run();
},
seed() {
return new Seeder_1.TestsSeeder(ace, connectionName).run();
},
truncate() {
return new Truncator_1.TestsTruncator(ace, connectionName).run();
},
};
});
}
exports.defineTestUtils = defineTestUtils;