Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
teekay committed Nov 11, 2024
1 parent 66e77d3 commit 1759dd9
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
1 change: 0 additions & 1 deletion AzureCommentsApiDelete/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ const commentsApi: AzureFunction = async function (context: Context, req: HttpRe
}

const forDate = new Date()
console.log(`Date: ${forDate}`)

const signatureVerificationResult = await authService.isHmacSignatureValid(
'DELETE',
Expand Down
33 changes: 33 additions & 0 deletions src/shared/emails/email.service.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { Comment } from "../comments/comment.interface"
import { EmailService } from "./email.service"

describe('Email Service', () => {
const emailSvc = new EmailService()
const comment: Comment = {
id: "foo",
account: {
id: "bar",
username: "tester",
email: "test@test.com",
createdAt: new Date(),
},
author: {
name: "John Doe",
email: "john.doe@test.com",
website: "http://johndoe.com"
},
postUrl: "http://test.com/post",
text: "This is a test comment",
postedAt: new Date(),
}

it('should include comment ID in the output', () => {
const result = emailSvc.notifyOnSingleComment(
comment,
'https://foobar.com/dashboard/123'
)

expect(result.text).toContain(comment.id)
expect(result.html).toContain(comment.id)
})
})

0 comments on commit 1759dd9

Please sign in to comment.