mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-04 01:40:08 +00:00
test: move bot utils test
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
import { expect } from 'chai'
|
||||
import { formatImageURL, hasProperty } from '../../src/utils/utils.js'
|
||||
|
||||
const obj = { prop: 'lts372005' }
|
||||
|
||||
it('[utils] hasProperty does HAVE property', () => {
|
||||
expect(hasProperty(obj, 'prop')).to.be.equal(true)
|
||||
})
|
||||
|
||||
it('[utils] hasProperty does NOT HAVE property', () => {
|
||||
expect(hasProperty(obj, 'lts372005')).to.be.equal(false)
|
||||
})
|
||||
|
||||
it('[utils] format image url', () => {
|
||||
expect(formatImageURL('https://skillz.is.pro')).to.be.equal(
|
||||
'https://skillz.is.pro.jpg?size=128'
|
||||
)
|
||||
expect(formatImageURL('https://skillz.is.pro', 1024)).to.be.equal(
|
||||
'https://skillz.is.pro.jpg?size=1024'
|
||||
)
|
||||
expect(formatImageURL('https://skillz.is.pro', 1024, 'gif')).to.be.equal(
|
||||
'https://skillz.is.pro.gif?size=1024'
|
||||
)
|
||||
expect(formatImageURL('https://skillz.is.pro', undefined, 'gif')).to.be.equal(
|
||||
'https://skillz.is.pro.gif?size=128'
|
||||
)
|
||||
})
|
||||
@@ -1,6 +1,6 @@
|
||||
import { expect } from 'chai'
|
||||
import sinon from 'sinon'
|
||||
import { delay } from '../src/utils.js'
|
||||
import { delay, formatImageURL, hasProperty } from '../src/utils.js'
|
||||
|
||||
describe('utils.ts', () => {
|
||||
let clock: sinon.SinonFakeTimers
|
||||
@@ -26,3 +26,28 @@ describe('utils.ts', () => {
|
||||
expect(delayEnded).to.be.true
|
||||
})
|
||||
})
|
||||
|
||||
const obj = { prop: 'lts372005' }
|
||||
|
||||
it('[utils] hasProperty does HAVE property', () => {
|
||||
expect(hasProperty(obj, 'prop')).to.be.equal(true)
|
||||
})
|
||||
|
||||
it('[utils] hasProperty does NOT HAVE property', () => {
|
||||
expect(hasProperty(obj, 'lts372005')).to.be.equal(false)
|
||||
})
|
||||
|
||||
it('[utils] format image url', () => {
|
||||
expect(formatImageURL('https://skillz.is.pro')).to.be.equal(
|
||||
'https://skillz.is.pro.jpg?size=128'
|
||||
)
|
||||
expect(formatImageURL('https://skillz.is.pro', 1024)).to.be.equal(
|
||||
'https://skillz.is.pro.jpg?size=1024'
|
||||
)
|
||||
expect(formatImageURL('https://skillz.is.pro', 1024, 'gif')).to.be.equal(
|
||||
'https://skillz.is.pro.gif?size=1024'
|
||||
)
|
||||
expect(formatImageURL('https://skillz.is.pro', undefined, 'gif')).to.be.equal(
|
||||
'https://skillz.is.pro.gif?size=128'
|
||||
)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user