Skip to content

Commit 0bfe9b6

Browse files
ezewerJacobPlaster
authored andcommitted
Add tests for ChangeLog
Add correspondent tests for change log model
1 parent af4ec53 commit 0bfe9b6

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

test/lib/models/change_logs.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/* eslint-env mocha */
2+
'use strict'
3+
4+
const assert = require('assert')
5+
6+
const { ChangeLog } = require('../../../lib')
7+
const testModel = require('../../helpers/test_model')
8+
const testModelValidation = require('../../helpers/test_model_validation')
9+
10+
describe('ChangeLog model', () => {
11+
testModel({
12+
model: ChangeLog,
13+
orderedFields: [
14+
'mtsCreate', null, 'log', null, null, 'ip', 'userAgent'
15+
]
16+
})
17+
18+
testModelValidation({
19+
model: ChangeLog,
20+
validData: {
21+
mtsCreate: new Array(...(new Array(5))).map(() => Math.random()),
22+
log: ['not', 'today', 'man', 'but', 'maybe', 'tomorrow'],
23+
ip: ['not', 'today', 'man', 'but', 'maybe', 'tomorrow'],
24+
userAgent: ['not', 'today', 'man', 'but', 'maybe', 'tomorrow']
25+
}
26+
})
27+
28+
describe('toString', () => {
29+
it('includes pertinent information', () => {
30+
const t = new ChangeLog({
31+
mtsCreate: 123456789,
32+
log: 'someLog',
33+
ip: '1.2.3.4',
34+
userAgent: 'firefox'
35+
})
36+
37+
assert.strictEqual(t.mtsCreate, 123456789, 'mts create missing')
38+
assert.strictEqual(t.log, 'someLog', 'log missing')
39+
assert.strictEqual(t.ip, '1.2.3.4', 'ip missing')
40+
assert.strictEqual(t.userAgent, 'firefox', 'user agent missing')
41+
})
42+
})
43+
})

0 commit comments

Comments
 (0)