Skip to content

Commit

Permalink
Runned prettier again
Browse files Browse the repository at this point in the history
  • Loading branch information
meatball133 committed Dec 29, 2022
1 parent 96c8bcb commit a5fef2f
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 86 deletions.
12 changes: 6 additions & 6 deletions exercises/concept/train-driver/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ The variable `moreRouteInformation` can contain different properties.
```

```javascript
route = { from: "Berlin", to: "Hamburg" };
moreRouteInformation = { length: "100", speed: "50" };
route = { from: 'Berlin', to: 'Hamburg' };
moreRouteInformation = { length: '100', speed: '50' };
extendRouteInformation(route, moreRouteInformation);
// => {from: "Berlin", to: "Hamburg", length: "100", speed: "50"}
```
Expand All @@ -86,10 +86,10 @@ The function should return an array there the first element of the array is the

```javascript
routeInformation = {
from: "Berlin",
to: "Hamburg",
length: "100",
timeOfArrival: "10:10",
from: 'Berlin',
to: 'Hamburg',
length: '100',
timeOfArrival: '10:10',
};
separateTimeOfArrival(routeInformation);
// => ["10:10", {from: "Berlin", to: "Hamburg", length: "100"}]
Expand Down
20 changes: 10 additions & 10 deletions exercises/concept/train-driver/.docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ Similarly to arrays, the rest operator can also be used to collect one or more o

```javascript
const { street, ...address } = {
street: "Platz der Republik 1",
postalCode: "11011",
city: "Berlin",
street: 'Platz der Republik 1',
postalCode: '11011',
city: 'Berlin',
};
street;
// => 'Platz der Republik 1'
Expand All @@ -46,11 +46,11 @@ When `...` appears in a function definition next to its last argument, that para

```javascript
function concat(...strings) {
return strings.join(" ");
return strings.join(' ');
}
concat("one");
concat('one');
// => 'one'
concat("one", "two", "three");
concat('one', 'two', 'three');
// => 'one two three'
```

Expand All @@ -65,7 +65,7 @@ const oneToFive = [1, 2, 3, 4, 5];
const oneToTen = [...oneToFive, 6, 7, 8, 9, 10];
oneToTen;
// => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
const woow = ["A", ...oneToFive, "B", "C", "D", "E", ...oneToFive, 42];
const woow = ['A', ...oneToFive, 'B', 'C', 'D', 'E', ...oneToFive, 42];
woow;
// => ["A", 1, 2, 3, 4, 5, "B", "C", "D", "E", 1, 2, 3, 4, 5, 42]
```
Expand All @@ -76,10 +76,10 @@ Similarly to arrays, the spread operator can also be used to copy properties fro

```javascript
let address = {
postalCode: "11011",
city: "Berlin",
postalCode: '11011',
city: 'Berlin',
};
address = { ...address, country: "Germany" };
address = { ...address, country: 'Germany' };
// => {
// postalCode: '11011',
// city: 'Berlin',
Expand Down
2 changes: 1 addition & 1 deletion exercises/concept/train-driver/train-driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ export function extendRouteInformation(route, moreRouteInformation) {
*/
export function separateTimeOfArrival(route) {
throw new Error('Please implement the separateTimeOfArrival function');
}
}
138 changes: 69 additions & 69 deletions exercises/concept/train-driver/train-driver.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,48 @@ import {
correctListOfWagons,
extendRouteInformation,
separateTimeOfArrival,
} from "./train-driver";
} from './train-driver';

describe("getListOfWagons", () => {
test("return the correct array", () => {
describe('getListOfWagons', () => {
test('return the correct array', () => {
expect(getListOfWagons(1, 5, 2, 7, 4)).toEqual([1, 5, 2, 7, 4]);
});

test("works for a few arrgument", () => {
test('works for a few arrgument', () => {
expect(getListOfWagons(1, 5)).toEqual([1, 5]);
});

test("works for a one arrgument", () => {
test('works for a one arrgument', () => {
expect(getListOfWagons(1)).toEqual([1]);
});

test("works for many argument", () => {
test('works for many argument', () => {
expect(getListOfWagons(1, 5, 6, 3, 9, 8, 4, 14, 24, 7)).toEqual([
1, 5, 6, 3, 9, 8, 4, 14, 24, 7,
]);
});
});

describe("fixListOfWagons", () => {
test("reorder the first 2 wagons to the end of the array", () => {
describe('fixListOfWagons', () => {
test('reorder the first 2 wagons to the end of the array', () => {
const eachWagonsID = [3, 7, 1, 14, 10, 4, 12, 6, 23, 17, 13, 20, 8, 19];
const expected = [1, 14, 10, 4, 12, 6, 23, 17, 13, 20, 8, 19, 3, 7];
expect(fixListOfWagons(eachWagonsID)).toEqual(expected);
});

test("works when only 3 wagons given", () => {
test('works when only 3 wagons given', () => {
const eachWagonsID = [4, 2, 1];
expect(fixListOfWagons(eachWagonsID)).toEqual([1, 4, 2]);
});

test("works for a few wagons", () => {
test('works for a few wagons', () => {
const eachWagonsID = [3, 4, 1, 5, 7, 9, 10];
expect(fixListOfWagons(eachWagonsID)).toEqual([1, 5, 7, 9, 10, 3, 4]);
});
});

describe("correctListOfWagons", () => {
test("returns a wagon wieght list with the inserted array of values", () => {
describe('correctListOfWagons', () => {
test('returns a wagon wieght list with the inserted array of values', () => {
const eachWagonsID = [1, 6, 11, 15, 13, 14, 17, 22, 2, 16, 19, 21];
const missingWagons = [8, 10, 5, 9, 3, 7, 20];
const expected = [
Expand All @@ -54,120 +54,120 @@ describe("correctListOfWagons", () => {
expect(correctListOfWagons(eachWagonsID, missingWagons)).toEqual(expected);
});

test("works for short arrays", () => {
test('works for short arrays', () => {
const eachWagonsID = [1, 7, 15, 24];
const missingWagons = [8, 6, 4];
const expected = [1, 8, 6, 4, 7, 15, 24];
expect(correctListOfWagons(eachWagonsID, missingWagons)).toEqual(expected);
});

test("works when missingWagons is longer", () => {
test('works when missingWagons is longer', () => {
const eachWagonsID = [1, 7, 15, 24];
const missingWagons = [8, 6, 4, 5, 9, 21, 2, 13];
const expected = [1, 8, 6, 4, 5, 9, 21, 2, 13, 7, 15, 24];
expect(correctListOfWagons(eachWagonsID, missingWagons)).toEqual(expected);
});
});

describe("extendRouteInformation", () => {
test("correctly extend route information", () => {
const route = { from: "Berlin", to: "Hamburg" };
describe('extendRouteInformation', () => {
test('correctly extend route information', () => {
const route = { from: 'Berlin', to: 'Hamburg' };
const moreRouteInformation = {
timeOfArrival: "12:00",
precipitation: "10",
temperature: "5",
timeOfArrival: '12:00',
precipitation: '10',
temperature: '5',
};
const expected = {
from: "Berlin",
to: "Hamburg",
timeOfArrival: "12:00",
precipitation: "10",
temperature: "5",
from: 'Berlin',
to: 'Hamburg',
timeOfArrival: '12:00',
precipitation: '10',
temperature: '5',
};
expect(extendRouteInformation(route, moreRouteInformation)).toEqual(
expected
);
});

test("works when not adding precipitation", () => {
const route = { from: "Paris", to: "London" };
const moreRouteInformation = { timeOfArrival: "10:30", temperature: "20" };
test('works when not adding precipitation', () => {
const route = { from: 'Paris', to: 'London' };
const moreRouteInformation = { timeOfArrival: '10:30', temperature: '20' };
const expected = {
from: "Paris",
to: "London",
timeOfArrival: "10:30",
temperature: "20",
from: 'Paris',
to: 'London',
timeOfArrival: '10:30',
temperature: '20',
};
expect(extendRouteInformation(route, moreRouteInformation)).toEqual(
expected
);
});

test("works when written in diffrent order", () => {
const route = { from: "Gothenburg", to: "Copenhagen" };
test('works when written in diffrent order', () => {
const route = { from: 'Gothenburg', to: 'Copenhagen' };
const moreRouteInformation = {
precipitation: "1",
timeOfArrival: "21:20",
temperature: "-6",
precipitation: '1',
timeOfArrival: '21:20',
temperature: '-6',
};
const expected = {
from: "Gothenburg",
to: "Copenhagen",
precipitation: "1",
timeOfArrival: "21:20",
temperature: "-6",
from: 'Gothenburg',
to: 'Copenhagen',
precipitation: '1',
timeOfArrival: '21:20',
temperature: '-6',
};
expect(extendRouteInformation(route, moreRouteInformation)).toEqual(
expected
);
});
});

describe("separateTimeOfArrival", () => {
test("seperate timeOfArrival from object", () => {
describe('separateTimeOfArrival', () => {
test('seperate timeOfArrival from object', () => {
const route = {
from: "Berlin",
to: "Hamburg",
timeOfArrival: "12:00",
precipitation: "10",
temperature: "5",
from: 'Berlin',
to: 'Hamburg',
timeOfArrival: '12:00',
precipitation: '10',
temperature: '5',
};
const expected = [
"12:00",
{ from: "Berlin", to: "Hamburg", precipitation: "10", temperature: "5" },
'12:00',
{ from: 'Berlin', to: 'Hamburg', precipitation: '10', temperature: '5' },
];
expect(separateTimeOfArrival(route)).toEqual(expected);
});

test("seperate timeOfArrival with shorter object", () => {
test('seperate timeOfArrival with shorter object', () => {
const route = {
from: "Paris",
to: "London",
timeOfArrival: "10:30",
temperature: "20",
from: 'Paris',
to: 'London',
timeOfArrival: '10:30',
temperature: '20',
};
const expected = [
"10:30",
{ from: "Paris", to: "London", temperature: "20" },
'10:30',
{ from: 'Paris', to: 'London', temperature: '20' },
];
expect(separateTimeOfArrival(route)).toEqual(expected);
});

test("seperate timeOfArrival from object", () => {
test('seperate timeOfArrival from object', () => {
const route = {
from: "Gothenburg",
to: "Copenhagen",
precipitation: "1",
timeOfArrival: "21:20",
temperature: "-6",
from: 'Gothenburg',
to: 'Copenhagen',
precipitation: '1',
timeOfArrival: '21:20',
temperature: '-6',
};
const expected = [
"21:20",
'21:20',
{
from: "Gothenburg",
to: "Copenhagen",
precipitation: "1",
temperature: "-6",
from: 'Gothenburg',
to: 'Copenhagen',
precipitation: '1',
temperature: '-6',
},
];
expect(separateTimeOfArrival(route)).toEqual(expected);
Expand Down

0 comments on commit a5fef2f

Please sign in to comment.