mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-04 15:39:42 +08:00
Added test for ScrambleStrings and formatted folder structure for other folders
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { haversineDistance } from './Haversine'
|
||||
import { haversineDistance } from '../Haversine'
|
||||
|
||||
describe('Testing the haversine distance calculator', () => {
|
||||
it('Calculate distance', () => {
|
@ -1,4 +1,4 @@
|
||||
import { quickSort } from './QuickSortRecursive'
|
||||
import { quickSort } from '../QuickSortRecursive'
|
||||
|
||||
describe('QuickSortRecursive | Partition In Place Method', () => {
|
||||
it('Expectedly, throw some error if we pass a non-array input', () => {
|
@ -1,4 +1,4 @@
|
||||
import { selectionSort } from './SelectionSort'
|
||||
import { selectionSort } from '../SelectionSort'
|
||||
|
||||
describe('selectionSort', () => {
|
||||
it('expects to return the array sorted in ascending order', () => {
|
@ -47,4 +47,4 @@ const helper = function (dp, s1, s2) {
|
||||
return false
|
||||
}
|
||||
|
||||
console.log(isScramble('great', 'rgeat'))
|
||||
export { isScramble }
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { checkVowels } from './CheckVowels'
|
||||
import { checkVowels } from '../CheckVowels'
|
||||
|
||||
describe('Test the checkVowels function', () => {
|
||||
it('expect throws on use wrong param', () => {
|
@ -1,4 +1,4 @@
|
||||
import { checkWordOccurrence } from './CheckWordOccurrence'
|
||||
import { checkWordOccurrence } from '../CheckWordOccurrence'
|
||||
describe('checkWordOccurrence', () => {
|
||||
it('expects throw on insert wrong string', () => {
|
||||
const value = 123
|
@ -1,4 +1,4 @@
|
||||
import { formatPhoneNumber } from './FormatPhoneNumber'
|
||||
import { formatPhoneNumber } from '../FormatPhoneNumber'
|
||||
|
||||
describe('PhoneNumberFormatting', () => {
|
||||
it('expects to return the formatted phone number', () => {
|
@ -1,4 +1,4 @@
|
||||
import { levenshteinDistance } from './LevenshteinDistance'
|
||||
import { levenshteinDistance } from '../LevenshteinDistance'
|
||||
|
||||
describe('levenshteinDistance', () => {
|
||||
it('should calculate edit distance between two strings', () => {
|
@ -1,4 +1,4 @@
|
||||
import { maxCharacter } from './MaxCharacter'
|
||||
import { maxCharacter } from '../MaxCharacter'
|
||||
|
||||
describe('Testing the maxCharacter function', () => {
|
||||
it('Expect throw with wrong arg', () => {
|
@ -1,4 +1,4 @@
|
||||
import { permutate } from './PermutateString'
|
||||
import { permutate } from '../PermutateString'
|
||||
|
||||
describe('Permutate a string', () => {
|
||||
it('expects to throw an Error with an empty string', () => {
|
15
String/test/ScrambleStrings.test.js
Normal file
15
String/test/ScrambleStrings.test.js
Normal file
@ -0,0 +1,15 @@
|
||||
import { isScramble } from '../ScrambleStrings'
|
||||
|
||||
describe('ScrambleStrings', () => {
|
||||
it('expects to return true for same string', () => {
|
||||
expect(isScramble('a', 'a')).toBe(true)
|
||||
})
|
||||
|
||||
it('expects to return false for non-scrambled strings', () => {
|
||||
expect(isScramble('abcde', 'caebd')).toBe(false)
|
||||
})
|
||||
|
||||
it('expects to return true for scrambled strings', () => {
|
||||
expect(isScramble('great', 'rgeat')).toBe(true)
|
||||
})
|
||||
})
|
@ -1,4 +1,4 @@
|
||||
import { getMonthDays } from './GetMonthDays'
|
||||
import { getMonthDays } from '../GetMonthDays'
|
||||
|
||||
describe('Get the Days of a Month', () => {
|
||||
it('expects to return 28', () => {
|
Reference in New Issue
Block a user