Skip to content

Commit

Permalink
test(secure_channel_store): add tests for matchit
Browse files Browse the repository at this point in the history
Closes #4
  • Loading branch information
RomainLanz committed Mar 5, 2024
1 parent 9ab9c4f commit 436b1fa
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/secure_channel_store.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* @adonisjs/transmit
*
* (c) AdonisJS
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

import { test } from '@japa/runner'
import { SecureChannelStore } from '../src/secure_channel_store.js'

test.group('SecureChannelStore', () => {
test('add channel to the store', async ({ assert }) => {
const store = new SecureChannelStore()

try {
store.add('users/:id')
} catch (error) {
assert.isTrue(false)
}
})

test('match channel', async ({ assert }) => {
const store = new SecureChannelStore()
store.add('users/:id')

const match = store.match('users/1')
assert.deepEqual(match, { params: { id: '1' }, url: 'users/:id' })
})
})

0 comments on commit 436b1fa

Please sign in to comment.