Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Added test for ScrambleStrings and formatted folder structure for oth…
…er folders
  • Loading branch information
omkarnathparida committed Oct 3, 2021
commit c198a9f53d2880d8cbbbc4482c20cec18a4a87f1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { haversineDistance } from './Haversine'
import { haversineDistance } from '../Haversine'

describe('Testing the haversine distance calculator', () => {
it('Calculate distance', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -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', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { selectionSort } from './SelectionSort'
import { selectionSort } from '../SelectionSort'

describe('selectionSort', () => {
it('expects to return the array sorted in ascending order', () => {
Expand Down
2 changes: 1 addition & 1 deletion String/ScrambleStrings.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ const helper = function (dp, s1, s2) {
return false
}

console.log(isScramble('great', 'rgeat'))
export { isScramble }
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { checkVowels } from './CheckVowels'
import { checkVowels } from '../CheckVowels'

describe('Test the checkVowels function', () => {
it('expect throws on use wrong param', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { checkWordOccurrence } from './CheckWordOccurrence'
import { checkWordOccurrence } from '../CheckWordOccurrence'
describe('checkWordOccurrence', () => {
it('expects throw on insert wrong string', () => {
const value = 123
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { formatPhoneNumber } from './FormatPhoneNumber'
import { formatPhoneNumber } from '../FormatPhoneNumber'

describe('PhoneNumberFormatting', () => {
it('expects to return the formatted phone number', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { levenshteinDistance } from './LevenshteinDistance'
import { levenshteinDistance } from '../LevenshteinDistance'

describe('levenshteinDistance', () => {
it('should calculate edit distance between two strings', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { maxCharacter } from './MaxCharacter'
import { maxCharacter } from '../MaxCharacter'

describe('Testing the maxCharacter function', () => {
it('Expect throw with wrong arg', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -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', () => {
Expand Down
15 changes: 15 additions & 0 deletions String/test/ScrambleStrings.test.js
Original file line number Diff line number Diff line change
@@ -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)
})
})
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getMonthDays } from './GetMonthDays'
import { getMonthDays } from '../GetMonthDays'

describe('Get the Days of a Month', () => {
it('expects to return 28', () => {
Expand Down