Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should remove entry from `lists_cards` after corresponding card was removed', () => {
return db.query(
`INSERT INTO lists(id, title) VALUES ('3', 'test list');
INSERT INTO cards(id, text) VALUES ('8', 'test card');
INSERT INTO lists_cards VALUES ('3', '8');
DELETE FROM cards WHERE id = '8'`
)
.then(() => db.query('SELECT * FROM lists_cards'))
.then(result => assert.lengthOf(result, 0));
});
});
function selectColumnsInfo(table) {
return db.query(
`SELECT column_name, data_type
FROM information_schema.columns
WHERE table_name = $1`
, table
);
}
.then(() => db.query(sql('cards.sql')));
});
.then(() => db.query('SELECT id, title FROM boards'))
.then(boards => assert.deepEqual(boards, [
.end((err, res) => {
if (err) { return done(err); }
assert.equal(res.statusCode, 201);
assert.deepEqual(res.body, {
result: {
id: 1,
title: 'test board 1',
}
});
db.query('SELECT board_id FROM users_boards WHERE user_id = 1')
.then(result => result.map(item => item.board_id))
.then(ids => assert.include(ids, 1))
.then(done, done);
});
});
.then(() => db.query('SELECT * FROM boards_lists'))
.then(result => assert.lengthOf(result, 0));
const findBoards = () => db.query(
`SELECT id, title FROM boards AS b
INNER JOIN users_boards AS ub ON (user_id = $1 AND ub.board_id = b.id)
GROUP BY b.id, ub.board_index
ORDER BY ub.board_index`,
[userId]
);
.then(() => db.query('SELECT * FROM test_1'))
.then(result => {
beforeEach(() => {
return db.query('DROP TABLE IF EXISTS cards')
.then(() => db.query(sql('cards.sql')));
});