fixed jasmine test order

Vic
Vic 2 years ago
parent 045071d1e9
commit ec732ace8b

@ -15,5 +15,5 @@
}
],
"stopSpecOnExpectationFailure": false,
"random": true
"random": false
}

@ -19,7 +19,7 @@ exports.setup = function(options, seedLink) {
};
exports.up = function(db) {
var filePath = path.join(__dirname, 'sqls', '20220518182209-shelf-up.sql');
var filePath = path.join(__dirname, 'sqls', '20220519015830-shelf-up.sql');
return new Promise( function( resolve, reject ) {
fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
if (err) return reject(err);
@ -34,7 +34,7 @@ exports.up = function(db) {
};
exports.down = function(db) {
var filePath = path.join(__dirname, 'sqls', '20220518182209-shelf-down.sql');
var filePath = path.join(__dirname, 'sqls', '20220519015830-shelf-down.sql');
return new Promise( function( resolve, reject ) {
fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
if (err) return reject(err);

@ -1,2 +0,0 @@
/* Replace with your SQL commands */
drop TABLE products

@ -1,4 +1,3 @@
/* Replace with your SQL commands */
CREATE TABLE products (
id SERIAL PRIMARY KEY,
name VARCHAR(250) NOT NULL,

@ -6,7 +6,7 @@
"scripts": {
"start": "nodemon src/server.ts",
"watch": "tsc-watch --esModuleInterop src/server.ts --outDir ./dist --onSuccess \"node ./dist/server.js\"",
"test": "db-migrate --env test up && ENV=test jasmine-ts --config jasmine.json || db-migrate --env test down",
"test": "db-migrate --env test up && ENV=test jasmine-ts --config jasmine.json && db-migrate --env test down",
"build": "npx tsc",
"lint": "eslint --ext .ts",
"prettier": "prettier \"src/**/*.ts\" --write",

@ -22,7 +22,7 @@ export class ProductStore {
}
}
async show(id: string): Promise<Product> {
async show(id: number): Promise<Product> {
try {
const sql = 'SELECT * FROM products where id=($1);'
// @ts-ignore

@ -39,17 +39,18 @@ describe("Products store Model", () => {
id: 1,
name: '1984',
price: 5,
}]);
});
it('show method should return a product', async () => {
const result = await store.show("1");
const result = await store.show(1);
expect(result).toEqual({
id: 1,
name: '1984',
price: 5,
});
});
it('delete method should remove the product', async () => {

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save