New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(DataResolver): fix circular dependency error with GuildTemplate #5622
Changes from all commits
ec5dcf4
a6a19ca
7e10633
118d492
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
'use strict'; | ||
|
||
/* eslint-env jest */ | ||
|
||
const { DataResolver } = require('../src'); | ||
|
||
describe('resolveGuildTemplateCode', () => { | ||
test('basic', () => { | ||
expect(DataResolver.resolveGuildTemplateCode('https://discord.new/abc')).toBe('abc'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wasn't sure if this test is really necessary, but because I technically changed the code in There don't seem to be many existing tests, so I just copied what was in |
||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
'use strict'; | ||
|
||
const { token } = require('./auth'); | ||
const { Client } = require('../src'); | ||
|
||
const client = new Client({ intents: ['GUILDS', 'GUILD_MESSAGES'] }); | ||
client | ||
.on('ready', () => console.log('ready')) | ||
.on('message', async message => { | ||
try { | ||
const templates = await message.guild.fetchTemplates(); | ||
if (!templates.size) { | ||
console.log('no templates'); | ||
} else { | ||
const guild = await templates.first().createGuild('guild name'); | ||
console.log(`created guild with ID ${guild.id}`); | ||
await guild.delete(); | ||
console.log('deleted guild'); | ||
} | ||
} catch (error) { | ||
console.error(error); | ||
} finally { | ||
client.destroy(); | ||
} | ||
}) | ||
.login(token) | ||
.catch(console.error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that
jest
is listed as a dev dependency inpackage.json
, so I enabled thejest
ESLint environment so thatno-undef
can still be enabled without spewing warnings aboutdescribe
,test
, andexpect
being undefined.