Skip to content

Commit

Permalink
some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jacoobes committed Feb 5, 2024
1 parent a50fb97 commit 3b4f9b9
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions test/core/id.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import { CommandType } from '../../src/core';
import * as Id from '../../src/core/id'
import { expect, test } from 'vitest'

test('id -> Text', () => {
const bothCmdId = Id.create("ping", CommandType.Text)
expect(bothCmdId).toBe("ping_T")
})

test('id -> Both', () => {
const bothCmdId = Id.create("ping", CommandType.Both)
expect(bothCmdId).toBe("ping_B")
})

test('id -> CtxMsg', () => {
const bothCmdId = Id.create("ping", CommandType.CtxMsg)
expect(bothCmdId).toBe("ping_A3")
})
test('id -> CtxUsr', () => {
const bothCmdId = Id.create("ping", CommandType.CtxUser)
expect(bothCmdId).toBe("ping_A2")
})
test('id -> Modal', () => {
const modal = Id.create("my-modal", CommandType.Modal)
expect(modal).toBe("my-modal_M");
})

test('id -> Button', () => {
const modal = Id.create("my-button", CommandType.Button)
expect(modal).toBe("my-button_C2");
})

test('id -> Slash', () => {
const modal = Id.create("myslash", CommandType.Slash)
expect(modal).toBe("myslash_A1");
})

test('id -> StringSelect', () => {
const modal = Id.create("mystringselect", CommandType.StringSelect)
expect(modal).toBe("mystringselect_C3");
})

test('id -> UserSelect', () => {
const modal = Id.create("myuserselect", CommandType.UserSelect)
expect(modal).toBe("myuserselect_C5");
})

test('id -> RoleSelect', () => {
const modal = Id.create("myroleselect", CommandType.RoleSelect)
expect(modal).toBe("myroleselect_C6");
})

test('id -> MentionSelect', () => {
const modal = Id.create("mymentionselect", CommandType.MentionableSelect)
expect(modal).toBe("mymentionselect_C7");
})

test('id -> ChannelSelect', () => {
const modal = Id.create("mychannelselect", CommandType.ChannelSelect)
expect(modal).toBe("mychannelselect_C8");
})



0 comments on commit 3b4f9b9

Please sign in to comment.