-
-
Notifications
You must be signed in to change notification settings - Fork 638
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into tools_testcases
- Loading branch information
Showing
10 changed files
with
237 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,11 +2,24 @@ | |
|
||
--- | ||
|
||
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --> | ||
[![All Contributors](https://img.shields.io/badge/all_contributors-52-orange.svg?style=flat-square)](#contributors-) | ||
<!-- ALL-CONTRIBUTORS-BADGE:END --> | ||
|
||
[![Netlify Status](https://api.netlify.com/api/v1/badges/b2137407-b765-46c4-95b5-a72d9b1592ab/deploy-status)](https://app.netlify.com/sites/asyncapi-website/deploys) | ||
<br/> | ||
<p align="center"> | ||
<a href="https://github.com/asyncapi/website/graphs/contributors" alt="AsyncAPI GitHub website contributors"> | ||
<img src="https://img.shields.io/github/contributors/asyncapi/website?color=orange" /> | ||
</a> | ||
<a href="https://github.com/asyncapi/website/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22" alt="Good First AsyncAPI issue"> | ||
<img src="https://img.shields.io/github/issues/asyncapi/website/good%20first%20issue.svg?color=%23DDDD00" /> | ||
</a> | ||
<a href="https://asyncapi.slack.com/" alt="AsyncAPI Slack"> | ||
<img src="https://img.shields.io/badge/[email protected]?logo=slack&color=yellow" /> | ||
</a> | ||
<a href="https://app.netlify.com/sites/asyncapi-website/deploys"> | ||
<img src="https://api.netlify.com/api/v1/badges/b2137407-b765-46c4-95b5-a72d9b1592ab/deploy-status" /> | ||
</a> | ||
<a href="https://github.com/asyncapi/website" alt="AsyncAPI Apache License"> | ||
<img src="https://img.shields.io/github/license/asyncapi/website.svg" /> | ||
</a> | ||
</p> | ||
|
||
## Overview | ||
|
||
|
@@ -140,7 +153,27 @@ This repository has the following structure: | |
└── tailwind.config.js # TailwindCSS configuration file | ||
``` | ||
|
||
## Contributors | ||
## Connect with AsyncAPI Community | ||
|
||
<p align="left"> | ||
<a href="https://asyncapi.slack.com/" target="blank"> | ||
<img align="center" src="https://img.icons8.com/color/48/null/slack-new.png" alt="AsyncAPI Slack" height="30" width="40" /> | ||
</a> | ||
<a href="https://twitter.com/asyncapispec" target="blank"> | ||
<img align="center" src="https://raw.githubusercontent.com/rahuldkjain/github-profile-readme-generator/master/src/images/icons/Social/twitter.svg" alt="AsyncAPI Twitter" height="30" width="40" /> | ||
</a> | ||
<a href="https://www.linkedin.com/company/asyncapi" target="blank"> | ||
<img align="center" src="https://raw.githubusercontent.com/rahuldkjain/github-profile-readme-generator/master/src/images/icons/Social/linked-in-alt.svg" alt="AsyncAPI LinkedIn" height="30" width="40" /> | ||
</a> | ||
<a href="https://www.youtube.com/c/asyncapi" target="blank"> | ||
<img align="center" src="https://raw.githubusercontent.com/rahuldkjain/github-profile-readme-generator/master/src/images/icons/Social/youtube.svg" alt="AsyncAPI YouTube" height="30" width="40" /> | ||
</a> | ||
<a href="https://www.twitch.tv/asyncapi" target="blank"> | ||
<img align="center" src="https://raw.githubusercontent.com/rahuldkjain/github-profile-readme-generator/master/src/images/icons/Social/twitch.svg" alt="AsyncAPI Twitch" height="30" width="40" /> | ||
</a> | ||
</p> | ||
|
||
## AsyncAPI Contributors ✨ | ||
|
||
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
import { sortFilter, applyFilterList, onFilterApply } from "../../../components/helpers/applyFilter"; | ||
|
||
describe('sortFilter function', () => { | ||
it('should sort an array of objects by their value property', () => { | ||
const input = [ | ||
{ name: 'Alice', value: 3 }, | ||
{ name: 'Bob', value: 1 }, | ||
{ name: 'Charlie', value: 2 }, | ||
]; | ||
const expected = [ | ||
{ name: 'Bob', value: 1 }, | ||
{ name: 'Charlie', value: 2 }, | ||
{ name: 'Alice', value: 3 }, | ||
]; | ||
const output = sortFilter(input); | ||
expect(output).to.deep.equal(expected); | ||
}); | ||
}); | ||
/** | ||
* this function is designed to generate filter lists based on the provided data and filter conditions. | ||
* It iterates through the data and creates filter entries in the lists according to certain rules, | ||
* including checking for duplicates and sorting the filter values. | ||
*/ | ||
|
||
describe('applyFilterList function', () => { | ||
it('should apply filters to a list of data and sort them by value', () => { | ||
//"checks" array that filters on the basis of name , age ,gender | ||
//we are checking if code works on expected Array or not | ||
const checks = [ | ||
{ name: 'name', checked: true }, | ||
{ name: 'age', checked: true }, | ||
{ name: 'gender', checked: true }, | ||
]; | ||
const data = [ | ||
{ name: 'Alice', age: 25, gender: 'female' }, | ||
{ name: 'Bob', age: 30, gender: 'male' }, | ||
{ name: 'Charlie', age: 28, gender: 'male' }, | ||
{ name: 'David', age: 22, gender: 'male' }, | ||
{ name: 'Eve', age: 27, gender: 'female' }, | ||
]; | ||
|
||
const expected = { | ||
name: [ | ||
{ value: 'Alice', text: 'Alice' }, | ||
{ value: 'Bob', text: 'Bob' }, | ||
{ value: 'Charlie', text: 'Charlie' }, | ||
{ value: 'David', text: 'David' }, | ||
{ value: 'Eve', text: 'Eve' }, | ||
], | ||
age: [ | ||
{ value: 22, text: 22 }, | ||
{ value: 25, text: 25 }, | ||
{ value: 27, text: 27 }, | ||
{ value: 28, text: 28 }, | ||
{ value: 30, text: 30 }, | ||
], | ||
gender: [ | ||
{ value: 'female', text: 'female' }, | ||
{ value: 'male', text: 'male' }, | ||
], | ||
}; | ||
let filters = {}; | ||
applyFilterList(checks, data, (lists) => { | ||
filters = lists; | ||
}); | ||
expect(filters).to.deep.equal(expected); | ||
}); | ||
}); | ||
|
||
describe('onFilterApply function', () => { | ||
/** | ||
* function onFilterApply that is intended to filter data based on a given query | ||
* and then call a specified callback function (onFilter) with the filtered result. | ||
*/ | ||
it('should filter a list of data by a query object and return the filtered result', () => { | ||
|
||
/** | ||
* mock data (an array of data to be filtered), | ||
* mock onFilter (a callback function to be called with the filtered data) | ||
* mock query (an object containing filter criteria). | ||
*/ | ||
const data = [ | ||
{ name: 'Alice', age: 25, gender: 'female', hobbies: ['reading', 'writing'] }, | ||
{ name: 'Bob', age: 30, gender: 'male', hobbies: ['gaming', 'coding'] }, | ||
{ name: 'Eve', age: 27, gender: 'female', hobbies: ['sports', 'dancing'] }, | ||
]; | ||
const query = { gender: 'female', hobbies: 'sports' }; | ||
const expected = [ | ||
{ name: 'Eve', age: 27, gender: 'female', hobbies: ['sports', 'dancing'] }, | ||
]; | ||
let result = []; | ||
onFilterApply(data, (filtered) => { | ||
result = filtered; | ||
}, query); | ||
|
||
expect(result).to.deep.equal(expected); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { isMobileDevice } from '../../../components/helpers/is-mobile'; | ||
|
||
// some user agents for testing | ||
const androidUA = 'Mozilla/5.0 (Linux; Android 10; SM-A205U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.210 Mobile Safari/537.36'; | ||
const iphoneUA = 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_4_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Mobile/15E148 Safari/604.1'; | ||
const kindleUA = 'Mozilla/5.0 (Linux; U; Android 4.0.3; en-us; KFTT Build/IML74K) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.4 Mobile Safari/535.19 Silk-Accelerated=true'; | ||
const ipadUA = 'Mozilla/5.0 (iPad; CPU OS 14_4_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Mobile/15E148 Safari/604.1'; | ||
const desktopUA = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36'; | ||
|
||
// Define a helper function to mock the navigator object | ||
function mockNavigator(userAgent) { | ||
Object.defineProperty(window, 'navigator', { | ||
value: { userAgent }, | ||
writable: true, | ||
}); | ||
} | ||
|
||
describe('isMobileDevice function', () => { | ||
// Test for android user agent | ||
it('should return true for android user agent', () => { | ||
// Mock the navigator with android user agent | ||
mockNavigator(androidUA); | ||
expect(isMobileDevice()).to.be.true; | ||
}); | ||
|
||
// Test for iphone user agent | ||
it('should return true for iphone user agent', () => { | ||
// Mock the navigator with iphone user agent | ||
mockNavigator(iphoneUA); | ||
expect(isMobileDevice()).to.be.true; | ||
}); | ||
|
||
// Test for kindle user agent | ||
it('should return true for kindle user agent', () => { | ||
// Mock the navigator with kindle user agent | ||
mockNavigator(kindleUA); | ||
expect(isMobileDevice()).to.be.true; | ||
}); | ||
|
||
// Test for ipad user agent | ||
it('should return true for ipad user agent', () => { | ||
// Mock the navigator with ipad user agent | ||
mockNavigator(ipadUA); | ||
expect(isMobileDevice()).to.be.true; | ||
}); | ||
|
||
// Test for desktop user agent | ||
it('should return false for desktop user agent', () => { | ||
// Mock the navigator with desktop user agent | ||
mockNavigator(desktopUA); | ||
expect(isMobileDevice()).to.be.true; | ||
}); | ||
}); |
Oops, something went wrong.