-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
3 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { expect } from 'chai'; | ||
import type Discord from 'discord.js'; | ||
|
||
import { getMessageMock } from '../../test/mocks'; | ||
|
||
import praca from './praca'; | ||
|
||
describe('praca', () => { | ||
it('should send links to websites', async () => { | ||
const mockLinks = [ | ||
'https://justjoin.it/', | ||
'https://nofluffjobs.com/', | ||
'https://bulldogjob.pl/', | ||
'https://www.pracuj.pl/', | ||
]; | ||
const msg = getMessageMock('msg', {}); | ||
|
||
await praca.execute(msg as unknown as Discord.Message, []); | ||
|
||
const embedData = ( | ||
msg.channel.send.args[0][0] as { readonly embeds: readonly Discord.EmbedBuilder[] } | ||
).embeds[0].data; | ||
|
||
expect(embedData.title).to.equal('Najlepsze portale z ofertami pracy'); | ||
expect(mockLinks.every((link) => embedData.description?.includes(link))).to.equal(true); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { EmbedBuilder } from 'discord.js'; | ||
|
||
import type { Command } from '../types'; | ||
|
||
const links = [ | ||
'https://justjoin.it/', | ||
'https://nofluffjobs.com/', | ||
'https://bulldogjob.pl/', | ||
'https://www.pracuj.pl/', | ||
]; | ||
|
||
const praca: Command = { | ||
name: 'praca', | ||
args: 'prohibited', | ||
description: 'Lista najlepszych portali z ofertami pracy', | ||
execute(msg) { | ||
const embed = new EmbedBuilder() | ||
.setTitle('Najlepsze portale z ofertami pracy') | ||
.setDescription(links.map((link, i) => `${i + 1}. ${link}`).join('\n')) | ||
.setColor('#5ab783') | ||
.setFooter({ | ||
text: 'Type of Web, Discord, Polska', | ||
iconURL: | ||
'https://cdn.discordapp.com/avatars/574682557988470825/8071299007c2d575c0912255baa19509.png?size=64', | ||
}) | ||
.setTimestamp(); | ||
|
||
return msg.channel.send({ embeds: [embed] }); | ||
}, | ||
}; | ||
|
||
export default praca; |