-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4204 from Cesar-Ch/add-cesar-solutions
Reto #26 - Javascript
- Loading branch information
Showing
1 changed file
with
31 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Crea tres test sobre el reto 12: "Viernes 13". | ||
* - Puedes copiar una solución ya creada por otro usuario en | ||
* el lenguaje que estés utilizando. | ||
* - Debes emplear un mecanismo de ejecución de test que posea | ||
* el lenguaje de programación que hayas seleccionado. | ||
* - Los tres test deben de funcionar y comprobar | ||
* diferentes situaciones (a tu elección). | ||
*/ | ||
|
||
import { describe, expect, it, } from "vitest"; | ||
|
||
function itsFridayThirteenth(month, year) { | ||
return new Date(`${month} 13, ${year}`).getDay() === 5 | ||
} | ||
|
||
|
||
|
||
describe('itsFridayThirteenth', () => { | ||
it('should return true for friday the 13th', () => { | ||
expect(itsFridayThirteenth('January', 2023)).toBe(true) | ||
}) | ||
|
||
it('should return false for friday the 13th', () => { | ||
expect(itsFridayThirteenth('May', 2022)).toBe(true) | ||
}) | ||
|
||
it('should return false for friday the 13th', () => { | ||
expect(itsFridayThirteenth('July', 2023)).toBe(false) | ||
}) | ||
}) |