Skip to content

Commit

Permalink
Fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
JAForbes committed Feb 15, 2024
1 parent 6a7634e commit 258e522
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
"dev": "node --watch --import tsx --test test/*.ts",
"build:bundle": "esbuild lib/index.ts --bundle --format=esm --sourcemap --allow-overwrite --outfile=./dist/superhistory.esm.js",
"build:types": "npx tsc -p tsconfig.test.json && npx tsc",
"build:test": "npm run test",
"build:clear": "rm -fr ./dist",
"build": "npm run build:clear && npm run build:bundle && npm run build:types",
"build": "npm run build:clear && npm run build:bundle && npm run build:types && npm run build:test",
"prepublishOnly": "npm version prerelease --preid=next && npm run build"
},
"publishConfig": {
Expand Down
12 changes: 6 additions & 6 deletions test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ test('Basics', () => {
A.go('/a/b/c/d/e/f/g/', { replace: true })
const b = A.get()

assert.deepEqual(a, { path: '/a/b/c/d/e/f/g' })
assert.deepEqual(a, { path: '/a/b/c/d/e/f/g', fullPath: '/a/b/c/d/e/f/g' })
assert.deepEqual(a, b, 'path normalization')

const B1 = A.child({ prefix: '/a/b' })
const B2 = A.child({ prefix: '/a/b/' })

assert.deepEqual(B1.get(), { path: '/c/d/e/f/g' })
assert.deepEqual(B1.get(), { path: '/c/d/e/f/g', fullPath: '/a/b/c/d/e/f/g' })
assert.deepEqual(B1.get(), B2.get())

A.go('/a/c/d')
Expand All @@ -37,23 +37,23 @@ test('Basics', () => {
`If child path isn't applicable, it has an undefined path`,
)

assert.deepEqual(A.get(), { path: '/a/c/d' })
assert.deepEqual(A.get(), { path: '/a/c/d', fullPath: '/a/c/d' })
B1.go('/d')
assert.deepEqual(
A.get(),
{ path: '/a/b/d' },
{ path: '/a/b/d', fullPath:'/a/b/d' },
'Writing to subroute reactivated its original prefix',
)

assert.deepEqual(B1.get(), { path: '/d' }, 'And path is no longer undefined')
assert.deepEqual(B1.get(), { path: '/d', fullPath:'/a/b/d' }, 'And path is no longer undefined')
assert.deepEqual(B1.get(), B2.get(), 'B1 and B2 are in sync')

B2.go('/c')

const C1 = B1.child({ prefix: '/c' })
const C2 = B2.child({ prefix: '/c' })

assert.deepEqual(C1.get(), { path: '/' })
assert.deepEqual(C1.get(), { path: '/', fullPath:'/a/b/c' })
})

test('Children of empty prefix', () => {
Expand Down

0 comments on commit 258e522

Please sign in to comment.