Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 0 additions & 57 deletions .eslintrc.yml

This file was deleted.

13 changes: 0 additions & 13 deletions .github/ISSUE_TEMPLATE/create-class.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,6 @@ body:
placeholder: '2024-01-15'
validations:
required: true
- type: textarea
id: administrators
attributes:
label: Administrators
description:
A list of GitHub handles and emails to add as repository administrators.
This should include anyone who will be delivering or supporting delivery
of this training.
placeholder: |
ncalteen,ncalteen@github.com
octocat,octocat@github.com
validations:
required: true
- type: textarea
id: attendees
attributes:
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/process-issue-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ jobs:
if: |
github.event.issue.state == 'open' &&
(
startsWith(github.event.comment.body, '.add-admin') ||
startsWith(github.event.comment.body, '.add-user') ||
startsWith(github.event.comment.body, '.remove-admin') ||
startsWith(github.event.comment.body, '.remove-user')
) &&
contains(github.event.issue.labels.*.name, 'gh-intermediate-class') &&
Expand Down
208 changes: 0 additions & 208 deletions __tests__/actions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,6 @@ describe('actions', () => {
customerAbbr: 'NA1',
startDate: new Date(2024, 10, 17),
endDate: new Date(2024, 10, 20),
administrators: [
{
handle: 'ncalteen',
email: 'ncalteen@github.com'
}
],
attendees: [
{
handle: 'ncalteen-testuser',
Expand Down Expand Up @@ -164,12 +158,6 @@ describe('actions', () => {
customerAbbr: 'NA1',
startDate: new Date(2024, 10, 17),
endDate: new Date(2024, 10, 20),
administrators: [
{
handle: 'ncalteen',
email: 'ncalteen@github.com'
}
],
attendees: [
{
handle: 'ncalteen-testuser',
Expand Down Expand Up @@ -204,12 +192,6 @@ describe('actions', () => {
customerAbbr: 'NA1',
startDate: new Date(2024, 10, 17),
endDate: new Date(2024, 10, 20),
administrators: [
{
handle: 'ncalteen',
email: 'ncalteen@github.com'
}
],
attendees: [
{
handle: 'ncalteen-testuser',
Expand All @@ -236,12 +218,6 @@ describe('actions', () => {
customerAbbr: 'NA1',
startDate: new Date(2024, 10, 17),
endDate: new Date(2024, 10, 20),
administrators: [
{
handle: 'ncalteen',
email: 'ncalteen@github.com'
}
],
attendees: [
{
handle: 'ncalteen-testuser',
Expand All @@ -265,12 +241,6 @@ describe('actions', () => {
customerAbbr: 'NA1',
startDate: new Date(2024, 10, 17),
endDate: new Date(2024, 10, 20),
administrators: [
{
handle: 'ncalteen',
email: 'ncalteen@github.com'
}
],
attendees: [
{
handle: 'ncalteen-testuser',
Expand Down Expand Up @@ -303,12 +273,6 @@ describe('actions', () => {
customerAbbr: 'NA1',
startDate: new Date(2023, 10, 17),
endDate: new Date(2023, 10, 20),
administrators: [
{
handle: 'ncalteen',
email: 'ncalteen@github.com'
}
],
attendees: [
{
handle: 'ncalteen-testuser',
Expand All @@ -325,127 +289,6 @@ describe('actions', () => {
})
})

describe('addAdmin()', () => {
it('Throws on Invalid Format', async () => {
try {
await actions.addAdmin(
{
action: AllowedIssueAction.CREATE,
customerName: 'Nick Testing Industries',
customerAbbr: 'NA1',
startDate: new Date(2024, 10, 17),
endDate: new Date(2024, 10, 20),
administrators: [
{
handle: 'ncalteen',
email: 'ncalteen@github.com'
}
],
attendees: [
{
handle: 'ncalteen-testuser',
email: 'ncalteen+testing@github.com'
}
]
},
{
issue: { number: 1 },
comment: {
body: '.add-admin invalid format'
}
} as any
)
} catch (error: any) {
// eslint-disable-next-line jest/no-conditional-expect
expect(error.message).toBe(
'Invalid Format! Try `.add-admin handle,email`'
)
}
})

it('Adds an Admin', async () => {
mocktokit.graphql.mockResolvedValue({
user: {
isEmployee: true,
email: 'noreply@github.com'
}
})

await actions.addAdmin(
{
action: AllowedIssueAction.CREATE,
customerName: 'Nick Testing Industries',
customerAbbr: 'NA1',
startDate: new Date(2024, 10, 17),
endDate: new Date(2024, 10, 20),
administrators: [
{
handle: 'ncalteen',
email: 'ncalteen@github.com'
}
],
attendees: [
{
handle: 'ncalteen-testuser',
email: 'ncalteen+testing@github.com'
}
]
},
{
issue: { number: 1 },
comment: {
body: '.add-admin ncalteen,ncalteen@github.com'
}
} as any
)

expect(teams_addUser).toHaveBeenCalled()
expect(issues_complete).toHaveBeenCalled()
})

it('Throws on Invalid Admin', async () => {
mocktokit.graphql.mockResolvedValue({
user: {
isEmployee: false,
email: 'fakeuser@notgithub.com'
}
})

try {
await actions.addAdmin(
{
action: AllowedIssueAction.CREATE,
customerName: 'Nick Testing Industries',
customerAbbr: 'NA1',
startDate: new Date(2024, 10, 17),
endDate: new Date(2024, 10, 20),
administrators: [
{
handle: 'ncalteen',
email: 'ncalteen@github.com'
}
],
attendees: [
{
handle: 'ncalteen-testuser',
email: 'ncalteen+testing@github.com'
}
]
},
{
issue: { number: 1 },
comment: {
body: '.add-admin fakeuser,fakeuser@notgithub.com'
}
} as any
)
} catch (error: any) {
// eslint-disable-next-line jest/no-conditional-expect
expect(error.message).toBe('Admins Must be GitHub/Microsoft Employees')
}
})
})

describe('addUser()', () => {
it('Throws on Invalid Format', async () => {
try {
Expand All @@ -456,12 +299,6 @@ describe('actions', () => {
customerAbbr: 'NA1',
startDate: new Date(2024, 10, 17),
endDate: new Date(2024, 10, 20),
administrators: [
{
handle: 'ncalteen',
email: 'ncalteen@github.com'
}
],
attendees: [
{
handle: 'ncalteen-testuser',
Expand Down Expand Up @@ -492,12 +329,6 @@ describe('actions', () => {
customerAbbr: 'NA1',
startDate: new Date(2024, 10, 17),
endDate: new Date(2024, 10, 20),
administrators: [
{
handle: 'ncalteen',
email: 'ncalteen@github.com'
}
],
attendees: [
{
handle: 'ncalteen-testuser',
Expand All @@ -519,43 +350,4 @@ describe('actions', () => {
expect(issues_complete).toHaveBeenCalled()
})
})

describe('removeAdmin()', () => {
it('Throws on Invalid Format', async () => {
try {
await actions.removeAdmin(
{
action: AllowedIssueAction.CREATE,
customerName: 'Nick Testing Industries',
customerAbbr: 'NA1',
startDate: new Date(2024, 10, 17),
endDate: new Date(2024, 10, 20),
administrators: [
{
handle: 'ncalteen',
email: 'ncalteen@github.com'
}
],
attendees: [
{
handle: 'ncalteen-testuser',
email: 'ncalteen+testing@github.com'
}
]
},
{
issue: { number: 1 },
comment: {
body: '.remove-admin invalid format'
}
} as any
)
} catch (error: any) {
// eslint-disable-next-line jest/no-conditional-expect
expect(error.message).toBe(
'Invalid Format! Try `.remove-admin handle,email`'
)
}
})
})
})
22 changes: 0 additions & 22 deletions __tests__/events.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,6 @@ describe('events', () => {
).toBe(undefined)
})

it('Returns Add Admin Action for .add-admin Issue Comment Events', () => {
expect(
events.getAction('issue_comment', {
action: 'created',
comment: {
body: '.add-admin handle,email'
}
} as any)
).toBe(AllowedIssueCommentAction.ADD_ADMIN)
})

it('Returns Add User for .add-user Issue Comment Events', () => {
expect(
events.getAction('issue_comment', {
Expand All @@ -76,17 +65,6 @@ describe('events', () => {
).toBe(AllowedIssueCommentAction.ADD_USER)
})

it('Returns Remove Admin for .remove-admin Issue Comment Events', () => {
expect(
events.getAction('issue_comment', {
action: 'created',
comment: {
body: '.remove-admin handle,email'
}
} as any)
).toBe(AllowedIssueCommentAction.REMOVE_ADMIN)
})

it('Returns Remove User for .remove-user Issue Comment Events', () => {
expect(
events.getAction('issue_comment', {
Expand Down
Loading