Skip to content

Instantly share code, notes, and snippets.

@minnacaptain
Created July 23, 2021 13:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save minnacaptain/0236d947cebaab73246a9ff9cea262e7 to your computer and use it in GitHub Desktop.
Save minnacaptain/0236d947cebaab73246a9ff9cea262e7 to your computer and use it in GitHub Desktop.
Testing the calculate function
import { assertEquals } from "https://deno.land/std@0.102.0/testing/asserts.ts";
import { calculateAverageScore } from './calculate.ts'
const mockGetContent = () => Promise.resolve(
"student_name,horoscope,exam_name,exam_score,feedback_score,would_recommend\n" +
"Braylen Natalia,Gemini,AWS Certified Cloud Practitioner,1,4.26,Yes\n" +
"Kash Macey,Leo,AWS Certified SysOps Administrator,2,3.04,Yes\n" +
"Erica Daniela,Sagittarius,AWS Certified Cloud Practitioner,3,7.61,Yes"
)
Deno.test("calculate", async () => {
const score = await calculateAverageScore(mockGetContent)
assertEquals(score, 2);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment