test: ensure legacy callback functions work (#16436)
* test: test legacy callback functions * add TODO removal comments * fix callback spec
This commit is contained in:
parent
720197f9c8
commit
f105c84349
6 changed files with 114 additions and 9 deletions
|
@ -836,7 +836,7 @@ describe('app module', () => {
|
|||
})
|
||||
})
|
||||
|
||||
describe('getFileIcon() API', () => {
|
||||
describe('getFileIcon() API', (done) => {
|
||||
const iconPath = path.join(__dirname, 'fixtures/assets/icon.ico')
|
||||
const sizes = {
|
||||
small: 16,
|
||||
|
@ -858,6 +858,14 @@ describe('app module', () => {
|
|||
expect(icon.isEmpty()).to.be.false()
|
||||
})
|
||||
|
||||
// TODO(codebytere): remove when promisification is complete
|
||||
it('fetches a non-empty icon (callback)', () => {
|
||||
app.getFileIcon(iconPath, (icon) => {
|
||||
expect(icon.isEmpty()).to.be.false()
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('fetches normal icon size by default', async () => {
|
||||
const icon = await app.getFileIcon(iconPath)
|
||||
const size = icon.getSize()
|
||||
|
@ -866,6 +874,17 @@ describe('app module', () => {
|
|||
expect(size.width).to.equal(sizes.normal)
|
||||
})
|
||||
|
||||
// TODO(codebytere): remove when promisification is complete
|
||||
it('fetches normal icon size by default (callback)', () => {
|
||||
app.getFileIcon(iconPath, (icon) => {
|
||||
const size = icon.getSize()
|
||||
|
||||
expect(size.height).to.equal(sizes.normal)
|
||||
expect(size.width).to.equal(sizes.normal)
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
describe('size option', () => {
|
||||
it('fetches a small icon', async () => {
|
||||
const icon = await app.getFileIcon(iconPath, { size: 'small' })
|
||||
|
@ -883,6 +902,17 @@ describe('app module', () => {
|
|||
expect(size.width).to.equal(sizes.normal)
|
||||
})
|
||||
|
||||
// TODO(codebytere): remove when promisification is complete
|
||||
it('fetches a normal icon (callback)', () => {
|
||||
app.getFileIcon(iconPath, { size: 'normal' }, (icon) => {
|
||||
const size = icon.getSize()
|
||||
|
||||
expect(size.height).to.equal(sizes.normal)
|
||||
expect(size.width).to.equal(sizes.normal)
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('fetches a large icon', async () => {
|
||||
// macOS does not support large icons
|
||||
if (process.platform === 'darwin') return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue