Code Coverage and Clean References (#120)

* Add: skeleton suite for command tests (#119)

* test naming updated

* fix imports, remove old references

* added code coverage badge

* Add: coverage environment

* Fix: Readme hyperlink to coverage workflow

* grab coverage pct from env

* Update: gist hyperlink

* color range on coverage

* fix contributing, simplify coverage assessment

* lmiit coverage to master, add branch naming conventions

---------

Co-authored-by: Kevin Dang <77701718+kevinthedang@users.noreply.github.com>
This commit is contained in:
Jonathan Smoley
2024-10-01 10:11:23 -07:00
committed by GitHub
parent e3b0c9abe4
commit 6a9ee2d6d0
25 changed files with 145 additions and 59 deletions

View File

@@ -2,7 +2,7 @@
// expect takes a value from an expression
// it marks a test case
import { describe, expect, it } from 'vitest'
import commands from '../src/commands'
import commands from '../src/commands/index.js'
/**
* Commands test suite, tests the commands object
@@ -12,7 +12,7 @@ import commands from '../src/commands'
* @param name name of the test suite
* @param fn function holding tests to run
*/
describe('#commands', () => {
describe('Commands Existence', () => {
// test definition of commands object
it('references defined object', () => {
// toBe compares the value to the expected value
@@ -24,4 +24,49 @@ describe('#commands', () => {
const commandsString = commands.map(e => e.name).join(', ')
expect(commandsString).toBe('thread, private-thread, message-style, message-stream, toggle-chat, shutoff, modify-capacity, clear-user-channel-history')
})
})
/**
* User Commands Test suite for testing out commands
* that would be run by users when using the application.
*/
describe('User Command Tests', () => {
// test capacity command
it('run modify-capacity command', () => {
})
it('run clear-user-channel-history command', () => {
})
it('run message-stream command', () => {
})
it('run message-style command', () => {
})
it('run thread command', () => {
})
it('run private-thread command', () => {
})
})
/**
* Admin Commands Test suite for running administrative
* commands with the application.
*/
describe('Admin Command Tests', () => {
it('run shutoff command', () => {
})
it('run toggle-chat command', () => {
})
})

View File

@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest'
import events from '../src/events'
import events from '../src/events/index.js'
/**
* Events test suite, tests the events object
@@ -9,7 +9,7 @@ import events from '../src/events'
* @param name name of the test suite
* @param fn function holding tests to run
*/
describe('#events', () => {
describe('Events Existence', () => {
// test definition of events object
it('references defined object', () => {
expect(typeof events).toBe('object')

View File

@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest'
import { getEnvVar } from '../src/utils'
import { getEnvVar } from '../src/utils/index.js'
/**
* getEnvVar test suite, tests the getEnvVar function
@@ -7,7 +7,7 @@ import { getEnvVar } from '../src/utils'
* @param name name of the test suite
* @param fn function holding tests to run
*/
describe('#getEnvVar', () => {
describe('Environment Setup', () => {
// dummy set of keys
const keys = {
clientToken: 'CLIENT_TOKEN',

View File

@@ -1,6 +1,5 @@
import { describe, expect, it } from 'vitest'
import { clean } from '../src/utils/mentionClean'
import { getEnvVar } from '../src/utils'
import { getEnvVar, clean } from '../src/utils/index.js'
/**
* MentionClean test suite, tests the clean function
@@ -8,7 +7,7 @@ import { getEnvVar } from '../src/utils'
* @param name name of the test suite
* @param fn function holding tests to run
*/
describe('#clean', () => {
describe('Mentions Cleaned', () => {
// test for id removal from message
it('removes the mention from a message', () => {
const message = `<@${getEnvVar('CLIENT_UID')}> Hello, World!`

View File

@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest'
import { Queue } from '../src/queues/queue'
import { Queue } from '../src/queues/queue.js'
/**
* Queue test suite, tests the Queue class
@@ -7,7 +7,7 @@ import { Queue } from '../src/queues/queue'
* @param name name of the test suite
* @param fn function holding tests to run
*/
describe('#queue', () => {
describe('Queue Structure', () => {
let queue= new Queue<string>()
// test for queue creation