Loading files
54d761463This file is pinned to the selected release. Download the original to open it in your design tool.
import assert from 'node:assert/strict'
import { test } from 'node:test'
import { StackchanRuntimeLighting } from '../runtime-lighting.js'
function fakeLed() {
const led = {
offCount: 0,
on: () => {},
off: () => {
led.offCount += 1
},
blink: () => {},
rainbow: () => {},
}
return led
}
test('StackchanRuntimeLighting close turns off every LED', () => {
const face = fakeLed()
const base = fakeLed()
const runtime = new StackchanRuntimeLighting({ led: { face, base } })
runtime.close()
assert.equal(face.offCount, 1)
assert.equal(base.offCount, 1)
})
test('StackchanRuntimeLighting close keeps turning off LEDs when one fails', () => {
const failing = {
on: () => {},
off: () => {
throw new Error('led failure')
},
blink: () => {},
rainbow: () => {},
}
const base = fakeLed()
const runtime = new StackchanRuntimeLighting({ led: { failing, base } })
runtime.close()
assert.equal(base.offCount, 1)
})
54d761463This file is pinned to the selected release. Download the original to open it in your design tool.
Files from this revision, including CAD and LFS contents. Git history is not included.
Or in GitHub Desktop, choose File → Clone repository → URL and paste this address.
Public repositories can be cloned without signing in. For pushing, use your ThingAtlas username and a Git access token as the password.
git lfs install git clone https://thingatlas.com/git/-unclaimed/stack-chan-374381865.git
Includes Git history, branches, and Git LFS files. Clones the repository’s default branch, regardless of the version shown here.