Skip to content

Commit

Permalink
Merge branch 'master' into dashboard_integration_tests
Browse files Browse the repository at this point in the history
  • Loading branch information
reachaadrika authored Jul 18, 2023
2 parents 5049edb + 039930a commit ed1d8d0
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 8 deletions.
12 changes: 7 additions & 5 deletions components/tools/ToolsCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,13 @@ export default function ToolsCard({ toolData }) {
{toolData.filters.language && <div className="flex flex-col gap-2 mx-6">
<Carddata classes= 'text-sm text-gray-700' heading="LANGUAGE" data = {Data.properties.filters.properties.language.description} type="lang" visible = {visible} setVisible = {setVisible} read={readMore} setRead ={setReadMore} />
<div className="flex gap-2">
<Tag
name={toolData.filters.language.name}
bgColor={toolData.filters.language.color}
borderColor={toolData.filters.language.borderColor}
/>
{toolData.filters.language.map((item, index) => (
<Tag key={index}
name={item.name}
bgColor={item.color}
borderColor={item.borderColor}
/>
))}
</div>
</div>}
{toolData.filters.technology.length > 0 && <div className="flex flex-col gap-2 my-4 mx-6">
Expand Down
22 changes: 20 additions & 2 deletions config/tools-manual.json
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@
"description": "React component to view the difference between two Json based API documents. Supported specifications: JsonSchema, OpenAPI 3.x, AsyncAPI 2.x.",
"links": {
"repoUrl": "https://github.com/udamir/api-diff-viewer",
"websiteUrl": "https://api-diff-viewer.vercel.app/",
"websiteUrl": "https://api-diff-viewer.vercel.app/"
},
"filters": {
"language": "TypeScript",
Expand Down Expand Up @@ -588,7 +588,25 @@
"language": "TypeScript",
"categories": ["compare-tool"]
}
}
},
{
"title": "jasyncapicmp",
"description": "Tool/library/maven-plugin for comparing two AsyncAPI versions and evaluating compatibility.",
"links": {
"websiteUrl": "https://siom79.github.io/jasyncapicmp/",
"repoUrl": "https://github.com/siom79/jasyncapicmp"
},
"filters": {
"language": "Java",
"technology": [
"Maven"
],
"categories": [
"compare-tool"
],
"hasCommercial": false
}
}
]
},
"Others": {
Expand Down
2 changes: 1 addition & 1 deletion config/tools.json

Large diffs are not rendered by default.

37 changes: 37 additions & 0 deletions cypress/test/lib/api.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { getAllPosts, getPostBySlug, getDocBySlug } from '../../../lib/api';
import posts from '../../../config/posts.json'
describe('getAllPosts', () => {
it('should return all posts', () => {
const allPosts = getAllPosts();
expect(allPosts).to.deep.equal(posts);
});
});

describe('getPostBySlug', () => {
it('should return the post with the given slug', () => {
const slug = '/blog/2023-may-docs-report';
const post = getPostBySlug(slug);
const expectedPost = posts.blog.find((p) => p.slug === slug && !p.isSection);
expect(post).to.deep.equal(expectedPost);
});

it('should return the post of a specific type with the given slug', () => {
const slug = '/blog/2023-may-docs-report';
const type = 'blog';
const post = getPostBySlug(slug, type);
const expectedPost = posts[type].find((p) => p.slug === slug && !p.isSection);
expect(post).to.deep.equal(expectedPost);
});
});

describe('getDocBySlug', () => {
it('should return the document with the given slug', () => {
const structuredPosts = posts['docs']
const slug = '/docs/concepts';
const doc = getDocBySlug(structuredPosts, slug);
const expectedDoc = structuredPosts.find((post) => post.slug === slug && !post.isSection);
expect(doc).to.deep.equal(expectedDoc);
});

});

45 changes: 45 additions & 0 deletions cypress/test/lib/staticHelpers.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { getEvents } from '../../../lib/staticHelpers';

describe('getEvents', () => {
it('should return sorted events in ascending order', () => {
const events = [
{
"title": "Community Meeting",
"calLink": "https://www.google.com/calendar/event?eid=czRmMG5maHRsYjduM2g3dmwxMDM1Z3R0NzAgY19xOXRzZWlnbG9tZHNqNm5qdWh2YnB0czExY0Bn",
"url": "https://github.com/asyncapi/community/issues/645",
"date": "2023-04-04T08:00:00.000Z"
},
{
"title": "Spec 3.0 Meeting",
"calLink": "https://www.google.com/calendar/event?eid=djhsdjZvbmRsampvb2tsYzhkZWFyc3FtYTAgY19xOXRzZWlnbG9tZHNqNm5qdWh2YnB0czExY0Bn",
"url": "https://github.com/asyncapi/community/issues/649",
"date": "2023-04-13T15:00:00.000Z"
},
{
"title": "Community Meeting",
"calLink": "https://www.google.com/calendar/event?eid=MzgwdmZiMTc4cnBmbTUzdWVlbmM4aWYyM2MgY19xOXRzZWlnbG9tZHNqNm5qdWh2YnB0czExY0Bn",
"url": "https://github.com/asyncapi/community/issues/659",
"banner": "https://user-images.githubusercontent.com/40604284/229763606-c0b6ed3b-e120-427c-b87d-357856d92777.png",
"date": "2023-04-18T16:00:00.000Z"
},
];

cy.wrap(events).as('events');

// Call the getEvents function
cy.get('@events').then((events) => {
const sortedEvents = getEvents(events);

// Check if the result is an array
expect(sortedEvents).to.be.an('array');

// Convert dates to timestamps for comparison
const sortedTimestamps = sortedEvents.map((event) => event.date.valueOf());

// Check if the timestamps are sorted in ascending order
for (let i = 0; i < sortedTimestamps.length - 1; i++) {
expect(sortedTimestamps[i]).to.be.greaterThan(sortedTimestamps[i + 1]);
}
});
});
});

0 comments on commit ed1d8d0

Please sign in to comment.