22 lines
924 B
JavaScript
22 lines
924 B
JavaScript
import test from 'node:test'
|
|
import assert from 'node:assert/strict'
|
|
import { readFile } from 'node:fs/promises'
|
|
|
|
const source = await readFile(new URL('../stores/picking.js', import.meta.url), 'utf8')
|
|
|
|
test('picking drafts are persisted under operator, task and cabinet identity', () => {
|
|
assert.match(source, /pda-picking-draft/)
|
|
assert.match(source, /operatorId/)
|
|
assert.match(source, /taskId/)
|
|
assert.match(source, /containerNo/)
|
|
assert.match(source, /uni\.setStorageSync\(key/)
|
|
assert.match(source, /uni\.getStorageSync\(key/)
|
|
assert.match(source, /uni\.removeStorageSync\(key/)
|
|
})
|
|
|
|
test('draft restore rejects a different operator or task', () => {
|
|
assert.match(source, /saved\.operatorId !== identityValue\(identity\)\.operatorId/)
|
|
assert.match(source, /saved\.taskId !== identityValue\(identity\)\.taskId/)
|
|
assert.match(source, /saved\.containerNo !== identityValue\(identity\)\.containerNo/)
|
|
})
|