Import AITURK IDE 1.0.0-beta.1 from Hermes 63279301; preserve MIT license
This commit is contained in:
commit
03634b1ca3
11340 files changed
+3442369
No files matched your search
@@ -0,0 +1,41 @@
|
||||
import { beforeEach, describe, expect, it } from 'vitest'
|
||||
|
||||
import {
|
||||
$previewStatusBySession,
|
||||
clearPreviewArtifacts,
|
||||
dismissPreviewArtifact,
|
||||
recordPreviewArtifact
|
||||
} from './preview-status'
|
||||
|
||||
beforeEach(() => $previewStatusBySession.set({}))
|
||||
|
||||
describe('recordPreviewArtifact', () => {
|
||||
it('appends new targets newest-last and is idempotent', () => {
|
||||
recordPreviewArtifact('s1', '/a/index.html', '/work')
|
||||
recordPreviewArtifact('s1', '/a/about.html', '/work')
|
||||
recordPreviewArtifact('s1', '/a/index.html', '/work')
|
||||
|
||||
expect($previewStatusBySession.get().s1.map(i => i.id)).toEqual(['/a/index.html', '/a/about.html'])
|
||||
})
|
||||
|
||||
it('caps the list and derives a label', () => {
|
||||
for (const n of [1, 2, 3, 4, 5]) {
|
||||
recordPreviewArtifact('s1', `/a/p${n}.html`, '/work')
|
||||
}
|
||||
|
||||
const list = $previewStatusBySession.get().s1
|
||||
expect(list).toHaveLength(4)
|
||||
expect(list[0].id).toBe('/a/p2.html')
|
||||
expect(list[3].label).toBe('p5.html')
|
||||
})
|
||||
|
||||
it('dismiss and clear remove rows', () => {
|
||||
recordPreviewArtifact('s1', '/a/index.html', '/work')
|
||||
recordPreviewArtifact('s1', '/a/about.html', '/work')
|
||||
dismissPreviewArtifact('s1', '/a/index.html')
|
||||
expect($previewStatusBySession.get().s1.map(i => i.id)).toEqual(['/a/about.html'])
|
||||
|
||||
clearPreviewArtifacts('s1')
|
||||
expect($previewStatusBySession.get().s1).toBeUndefined()
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user