Skip to content

Commit

Permalink
Add a test to ensure 'not implemented' is tested
Browse files Browse the repository at this point in the history
  • Loading branch information
Cruikshanks committed Jan 5, 2023
1 parent 8686abe commit 96226bd
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions test/models/legacy-base.model.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
'use strict'

// Test framework dependencies
const Lab = require('@hapi/lab')
const Code = require('@hapi/code')

const { describe, it } = exports.lab = Lab.script()
const { expect } = Code

// Thing under test
const LegacyBaseModel = require('../../app/models/legacy-base.model.js')

describe('Legacy Base model', () => {
describe('.schema()', () => {
describe('when the getter is not overridden', () => {
class BadModel extends LegacyBaseModel {}

it('throws an error when called', () => {
expect(() => BadModel.query()).to.throw()
})
})

describe('when the getter is overridden', () => {
class GoodModel extends LegacyBaseModel {
static get schema () {
return 'water'
}
}

it('does not throw an error when called', () => {
expect(() => GoodModel.query()).not.to.throw()
})
})
})
})

0 comments on commit 96226bd

Please sign in to comment.