Skip to content

Commit

Permalink
chore: change nkowaokwu dictionary link and write test
Browse files Browse the repository at this point in the history
  • Loading branch information
ijemmao committed Jun 15, 2023
1 parent 69cca63 commit fac4b55
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 23 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ module.exports = {
'plugin:cypress/recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
],
parser: '@typescript-eslint/parser',
parserOptions: {
Expand Down
17 changes: 17 additions & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// eslint-disable-next-line import/no-extraneous-dependencies
const { defineConfig } = require('cypress');

module.exports = defineConfig({
e2e: {
baseUrl: 'http://localhost:8080',
video: false,
chromeWebSecurity: false,
execTimeout: 5000,
retries: {
runMode: 2,
},
pageLoadTimeout: 30000,
taskTimeout: 30000,
specPattern: 'cypress/e2e/**/*.cy.{js,jsx,ts,tsx}',
},
});
14 changes: 0 additions & 14 deletions cypress.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
import { v4 as uuid } from 'uuid';

describe('Igbo API Homepage', () => {
before(() => {
beforeEach(() => {
cy.visit('/');
});

describe('Outside links', () => {
it('navigate to Nkọwa okwu website', () => {
cy.get('[data-test="nkowaokwu-link"]').click();
cy.url().should('equal', 'https://nkowaokwu.com/home');
cy.contains('Internal Server Error').should('not.exist');
});
});

describe('Desktop', () => {
beforeEach(() => {
cy.viewport('macbook-16');
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@
},
"lint-staged": {
"*.{js,ts}": [
"./node_modules/.bin/prettier --write", "./node_modules/.bin/eslint"
"./node_modules/.bin/prettier --write",
"./node_modules/.bin/eslint"
]
},
"license": "ISC",
Expand Down Expand Up @@ -151,7 +152,7 @@
"@typescript-eslint/parser": "^5.59.6",
"babel-loader": "^8.1.0",
"cross-env": "^7.0.2",
"cypress": "^6.0.0",
"cypress": "^12.14.0",
"eslint": "8.34.0",
"eslint-config-airbnb": "19.0.4",
"eslint-config-airbnb-typescript": "^17.0.0",
Expand Down
11 changes: 6 additions & 5 deletions src/pages/components/Demo/Demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,10 @@ const Demo = ({ searchWord, words }) => {

const constructRequestUrl = () => {
const appendQueries = constructQueryString() || queryString.stringify(omit(initialQueries, ['word']));
const requestUrl = `${productionUrl || API_ROUTE}/api/v1/words?keyword=${keyword || ''}`
+ `${keyword && appendQueries ? '&' : ''}`
+ `${appendQueries.replace('&', '')}`;
const requestUrl =
`${productionUrl || API_ROUTE}/api/v1/words?keyword=${keyword || ''}` +
`${keyword && appendQueries ? '&' : ''}` +
`${appendQueries.replace('&', '')}`;
return requestUrl;
};

Expand Down Expand Up @@ -83,7 +84,7 @@ const Demo = ({ searchWord, words }) => {
<form onSubmit={onSubmit} className="flex flex-col w-full space-y-5">
<h2>{t('Enter a word below')}</h2>
<p className="self-center md:self-start">
{t('Enter a word in either English or Igbo to see it\'s information')}
{t("Enter a word in either English or Igbo to see it's information")}
</p>
<Input
size="large"
Expand Down Expand Up @@ -134,7 +135,7 @@ const Demo = ({ searchWord, words }) => {
</Button>
<p className="text-l text-center text-gray-700 self-center mb-24">
{t('Want to see how this data is getting used? Take a look at ')}
<a className="link" href={DICTIONARY_APP_URL}>
<a className="link" href={DICTIONARY_APP_URL} data-test="nkowaokwu-link">
Nkọwa okwu
</a>
</p>
Expand Down
2 changes: 1 addition & 1 deletion src/siteConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export const PORT = 8080;
export const API_FROM_EMAIL = '[email protected]';
export const APP_URL = 'https://igboapi.com';
export const API_ROUTE = APP_URL;
export const DICTIONARY_APP_URL = 'https://nkowaokwu.com/home';
export const DICTIONARY_APP_URL = 'https://nkowaokwu.com';
export const GITHUB_REPO = 'https://github.com/nkowaokwu/igbo_api';
export const GITHUB_CONTRIBUTORS = 'https://api.github.com/repos/nkowaokwu/igbo_api/contributors';
export const GITHUB_STARS = 'https://api.github.com/repos/nkowaokwu/igbo_api';
Expand Down

0 comments on commit fac4b55

Please sign in to comment.