Skip to content

Instantly share code, notes, and snippets.

@jeffsoup
jeffsoup / bookshelf-transaction-test.js
Last active July 31, 2021 02:32
Small Example of A Bookshelf Transaction
import config from '../src/config'
import chai, { expect, should, assert } from 'chai'
import _ from 'lodash'
const knex = require('knex')(config.database)
const bookshelf = require('bookshelf')(knex)
const Test = bookshelf.Model.extend({
tableName: 'TEST_ONLY',
idAttribute: 'ID',
@jeffsoup
jeffsoup / seasoned-unit-testing-standards.md
Created October 3, 2017 22:11
Seasoned Unit Testing Standards

Unit Testing Requirements

Pull Requests with new development will be rejected if there no unit tests

Code Coverage Expectations

All new development should have 100% coverage. If something cannot have a test created for it please note why you cannot create the test in the code and pass the work onto whomever you think should create the test (if possible).

Unused Code

Delete it and all associated unit tests. We don't want dead or orphaned code in the application.

When Mocking Data