Skip to content

Commit

Permalink
Made output adapter static
Browse files Browse the repository at this point in the history
  • Loading branch information
Replit user committed Nov 7, 2023
1 parent 331fedc commit f3267e9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class CountriesInputAdapterStub {
}

class MockCountriesOutputAdapter {
write(countrList) {
static write(countrList) {
let csvContent = "";

countrList.forEach(function(rowArray) {
Expand All @@ -48,7 +48,7 @@ describe('A list without countries (empty list)', () => {
let countryList;

beforeEach(async () => {
countryList = await CountryList.create_instance(EmptyCountriesInputAdapterStub, new MockCountriesOutputAdapter());
countryList = await CountryList.create_instance(EmptyCountriesInputAdapterStub, MockCountriesOutputAdapter);
});

it('should sort the empty list', () => {
Expand All @@ -69,7 +69,7 @@ describe('A list with countries', () => {
let countryList;

beforeEach(async () => {
countryList = await CountryList.create_instance(CountriesInputAdapterStub, new MockCountriesOutputAdapter());
countryList = await CountryList.create_instance(CountriesInputAdapterStub, MockCountriesOutputAdapter);
});


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class CountryList {
this.outputPort = outputPort;
}

static async create_instance(inputPort = RestCountriesInputAdapter, outputPort = new CsvOutputAdapter()) {
static async create_instance(inputPort = RestCountriesInputAdapter, outputPort = CsvOutputAdapter) {
return new CountryList(await inputPort.instance(), outputPort);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const fs = require('fs');

class CsvOutputAdapter {
write(countrList) {
static write(countrList) {
let csvContent = "";

countrList.forEach(function (rowArray) {
Expand Down
10 changes: 5 additions & 5 deletions tdd-katas/countries-kata/countries-kata-javascript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ constructor(inputPort, outputPort) {
this.outputPort = outputPort;
}

static async create_instance(inputPort = RestCountriesInputAdapter, outputPort = new CsvOutputAdapter()) {
static async create_instance(inputPort = RestCountriesInputAdapter, outputPort = CsvOutputAdapter {
return new CountryList(await inputPort.instance(), outputPort);
}
```
Expand Down Expand Up @@ -368,7 +368,7 @@ an empty list of countries.
let countryList;

beforeEach(async () => {
countryList = await CountryList.create_instance(EmptyCountriesInputAdapterStub, new MockCountriesOutputAdapter());
countryList = await CountryList.create_instance(EmptyCountriesInputAdapterStub, MockCountriesOutputAdapter;
});

it('should sort the empty list', () => {
Expand Down Expand Up @@ -413,7 +413,7 @@ class CountriesInputAdapterStub {
let countryList;

beforeEach(async () => {
countryList = await CountryList.create_instance(CountriesInputAdapterStub, new MockCountriesOutputAdapter());
countryList = await CountryList.create_instance(CountriesInputAdapterStub, MockCountriesOutputAdapter);
});


Expand Down Expand Up @@ -467,7 +467,7 @@ as in addition to `fs.writeFile()` there is a
```javascript
class CsvOutputAdapter {
write(countrList) {
static write(countrList) {
let csvContent = "";

countrList.forEach(function (rowArray) {
Expand All @@ -493,7 +493,7 @@ that is normally written to a (CSV) file.
```javascript

class MockCountriesOutputAdapter {
write(countrList) {
static write(countrList) {
let csvContent = "";

countrList.forEach(function(rowArray) {
Expand Down

0 comments on commit f3267e9

Please sign in to comment.