Skip to content

Commit

Permalink
fix sync-lists script and tests
Browse files Browse the repository at this point in the history
Run schema validation tests first to ensure the app will be able to run
  • Loading branch information
moshfeu committed Feb 25, 2019
1 parent 4717953 commit c1ff3aa
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
5 changes: 4 additions & 1 deletion scripts/sync-lists.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ function generateLists() {
}

for (let i = 0; i < mentors.length; i++) {
json.tags.push(...mentors[i].tags);
json.tags.push(...(mentors[i].tags || []));
json.countries.push(mentors[i].country);
}

json.tags = [...new Set(json.tags)]
json.countries = [...new Set(json.countries)]

return json;
}

Expand Down
5 changes: 4 additions & 1 deletion src/components/App/App.test.js → src/__tests__/App.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import App from '../components/App/App'

// run this tests first
import './mentors.json-test';

it('renders without crashing', () => {
const div = document.createElement('div');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import mentors from './mentors.json';
import mentors from '../mentors.json';
import Ajv from 'ajv';
import lists from './lists.json';
import lists from '../lists.json';

import generateLists from '../scripts/sync-lists';
import generateLists from '../../scripts/sync-lists';

it('should mentors json contains all fields', () => {
var ajv = new Ajv({ removeAdditional: false });
Expand Down
2 changes: 1 addition & 1 deletion src/lists.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"tags":["frontend","javascript","reactjs","html","css","frontend","javascript","react","native","css"],"countries":["Israel","USA"]}
{"tags":["frontend","javascript","reactjs","html","css","react","native"],"countries":["Israel","USA"]}

0 comments on commit c1ff3aa

Please sign in to comment.