-
Notifications
You must be signed in to change notification settings - Fork 24
Solution for #5 #106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Solution for #5 #106
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,19 @@ | ||
| // Name | ||
| // Problem Description | ||
| // Phillip Kelley-Dotson | ||
| // Arrange numbers and strings into ascending order. | ||
|
|
||
| const solution3 = (actual) => { | ||
| if(/^[a-zA-Z]+$/.test(actual[0]) === true){ actual.sort(); | ||
| return actual; | ||
| } else { | ||
| actual.sort(function (a,b){ | ||
| return a-b; | ||
| }); | ||
| return actual; | ||
| } | ||
| }; | ||
|
|
||
|
|
||
| const yourSolution = () => { | ||
| }; | ||
|
|
||
| module.exports = { | ||
| yourSolution, | ||
| solution3, | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| const expect = require('chai').expect; | ||
| let solution = require('../solutions/5').solution; | ||
| let solution2 = require('../solutions/5').solution2; | ||
| let solution3 = require('../solutions/yourSolution').solution3; | ||
|
|
||
| describe('sort arrays', () => { | ||
| // solution tests | ||
|
|
@@ -47,5 +48,12 @@ describe('sort arrays', () => { | |
| const actual = [57]; | ||
| const expected = [57]; | ||
| expect(solution2(actual)).eql(expected); | ||
| }); | ||
| }); | ||
| // for solution3 | ||
| it.only('solution2 - array should have numbers in ascending order - single', | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why are you duplicating a test case that is already written in line 30? |
||
| () => { | ||
| const actual = [1, 5, 31, 57, 2, 0]; | ||
| const expected = [0, 1, 2, 5, 31, 57]; | ||
| expect(solution3(actual)).eql(expected); | ||
| }); | ||
| }); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| const expect = require('chai').expect; | ||
| let solution = require('../solutions/64').solution; | ||
| // solution = require('./yourSolution').solution; | ||
| let solution2 = require('../solutions/64').solution2; | ||
|
|
||
| describe('reverse word order in a sentence', () => { | ||
| it('should reverse the word order', () => { | ||
|
|
@@ -9,4 +9,8 @@ describe('reverse word order in a sentence', () => { | |
| it('should return I', () => { | ||
| expect(solution('I')).eql('I'); | ||
| }); | ||
| it.only('should reverse word order', () => { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what is this file doing in your MR to submit solution to #5 ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe this will help! https://github.com/llipio/algorithms/wiki/Git-and-branching |
||
| expect(solution2('happy goes it')).eql('it goes happy'); | ||
|
|
||
| }); | ||
| }); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should not commit anything in yourSolution.js