-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(e2e): add tests for toDeleteRole and fix it
- Loading branch information
1 parent
51d2fae
commit a3cec60
Showing
6 changed files
with
90 additions
and
11 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,22 @@ | ||
// @ts-nocheck | ||
|
||
import corde from "../../../lib"; | ||
import { login, getRole, bot, getRoleManager } from "../../bot"; | ||
|
||
let role = null; | ||
const roleName = "role-to-delete"; | ||
|
||
corde.test("", async () => { | ||
await login(); | ||
role = getRole(roleName); | ||
corde.expect(`deleteRole ${role.id}`).toDeleteRole(role.id); | ||
}); | ||
|
||
corde.afterAll(async () => { | ||
await getRoleManager().create({ | ||
data: { | ||
name: roleName, | ||
}, | ||
}); | ||
bot.destroy(); | ||
}); |
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,17 @@ | ||
// @ts-nocheck | ||
|
||
import corde from "../../../lib"; | ||
import { login, getRole, bot } from "../../bot"; | ||
|
||
let role = null; | ||
const roleName = "role-to-delete"; | ||
|
||
corde.test("", async () => { | ||
await login(); | ||
role = getRole(roleName); | ||
corde.expect(`deleteRole abc`).toDeleteRole(role.id); | ||
}); | ||
|
||
corde.afterAll(async () => { | ||
bot.destroy(); | ||
}); |
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,14 @@ | ||
import Utils from "../testUtils"; | ||
import { messages } from "../../src/messages"; | ||
import cli from "../cliRunner"; | ||
|
||
describe("testing toDeleteRole", () => { | ||
test("should delete a role", async (done) => { | ||
const command = Utils.buildCommandWithConfigPath("toDeleteRole", "bot_case1.test.ts"); | ||
const results = await cli.exec(command); | ||
expect(results.stdout).toContain(messages.ALL_TESTS_PASSED); | ||
expect(results.stdout).toContain(messages.TOTAL + " 1"); | ||
expect(results.statusCode).toEqual(0); | ||
done(); | ||
}); | ||
}); |
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,14 @@ | ||
import Utils from "../testUtils"; | ||
import { messages } from "../../src/messages"; | ||
import cli from "../cliRunner"; | ||
|
||
describe("testing toDeleteRole", () => { | ||
test("should fail", async (done) => { | ||
const command = Utils.buildCommandWithConfigPath("toDeleteRole", "bot_case2.test.ts"); | ||
const results = await cli.exec(command); | ||
expect(results.stdout).toContain(messages.ALL_TESTS_FAIL); | ||
expect(results.stdout).toContain(messages.FAILURES + " 1"); | ||
expect(results.statusCode).toEqual(1); | ||
done(); | ||
}); | ||
}); |
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