45 lines
796 B
JavaScript
45 lines
796 B
JavaScript
import test from 'node:test'
|
|
import assert from 'node:assert/strict'
|
|
|
|
import { shouldCaptureBeijingTimeProof } from './session-proof.js'
|
|
|
|
test('shouldCaptureBeijingTimeProof only returns true for successful redeem results', () => {
|
|
assert.equal(
|
|
shouldCaptureBeijingTimeProof({
|
|
classification: {
|
|
success: true,
|
|
},
|
|
}),
|
|
true,
|
|
)
|
|
|
|
assert.equal(
|
|
shouldCaptureBeijingTimeProof({
|
|
classification: {
|
|
success: false,
|
|
},
|
|
}),
|
|
false,
|
|
)
|
|
|
|
assert.equal(
|
|
shouldCaptureBeijingTimeProof({
|
|
redeem: {
|
|
iRet: 0,
|
|
},
|
|
}),
|
|
true,
|
|
)
|
|
|
|
assert.equal(
|
|
shouldCaptureBeijingTimeProof({
|
|
redeem: {
|
|
iRet: -183,
|
|
},
|
|
}),
|
|
false,
|
|
)
|
|
|
|
assert.equal(shouldCaptureBeijingTimeProof(null), false)
|
|
})
|