|
1 | 1 | const should = require('should') // eslint-disable-line |
| 2 | +const { UpdatesCollection } = require('../../../../forge/auditLog/formatters') |
| 3 | + |
2 | 4 | const FF_UTIL = require('flowforge-test-utils') |
3 | 5 | // Declare a dummy getLoggers function for type hint only |
4 | 6 | /** @type {import('../../../../forge/auditLog/project').getLoggers} */ |
@@ -286,6 +288,25 @@ describe('Audit Log > Project', async function () { |
286 | 288 | logEntry.body.snapshot.id.should.equal(SNAPSHOT.hashid) |
287 | 289 | }) |
288 | 290 |
|
| 291 | + it('Provides a logger for updating snapshots of a project', async function () { |
| 292 | + const updates = new UpdatesCollection() |
| 293 | + updates.pushDifferences({ name: 'old' }, { name: 'new' }) |
| 294 | + await projectLogger.project.snapshot.updated(ACTIONED_BY, null, PROJECT, SNAPSHOT, updates) |
| 295 | + // check log stored |
| 296 | + const logEntry = await getLog() |
| 297 | + logEntry.should.have.property('event', 'project.snapshot.updated') |
| 298 | + logEntry.should.have.property('scope', { id: PROJECT.id, type: 'project' }) |
| 299 | + logEntry.should.have.property('trigger', { id: ACTIONED_BY.hashid, type: 'user', name: ACTIONED_BY.username }) |
| 300 | + logEntry.should.have.property('body') |
| 301 | + logEntry.body.should.only.have.keys('project', 'snapshot', 'updates') |
| 302 | + logEntry.body.project.should.only.have.keys('id', 'name') |
| 303 | + logEntry.body.project.id.should.equal(PROJECT.id) |
| 304 | + logEntry.body.snapshot.should.only.have.keys('id', 'name') |
| 305 | + logEntry.body.snapshot.id.should.equal(SNAPSHOT.hashid) |
| 306 | + logEntry.body.updates.should.have.length(1) |
| 307 | + logEntry.body.updates[0].should.eql({ key: 'name', old: 'old', new: 'new', dif: 'updated' }) |
| 308 | + }) |
| 309 | + |
289 | 310 | it('Provides a logger for rolling back a snapshot of a project', async function () { |
290 | 311 | await projectLogger.project.snapshot.rolledBack(ACTIONED_BY, null, PROJECT, SNAPSHOT) |
291 | 312 | // check log stored |
|
0 commit comments