fix test files

This commit is contained in:
Rohid
2024-08-31 17:51:40 +06:00
parent d7cd69783b
commit fd94e53ac1
6 changed files with 87 additions and 77 deletions

133
package-lock.json generated
View File

@@ -24,7 +24,7 @@
"react-transition-group": "^4.4.5",
"redux-logger": "^4.0.0",
"uuid": "^10.0.0",
"webextension-polyfill": "^0.12.0"
"webextension-polyfill": "^0.10.0"
},
"devDependencies": {
"@babel/core": "^7.25.2",
@@ -60,7 +60,7 @@
"babel-jest": "^29.7.0",
"babel-loader": "^9.1.3",
"browserify": "^17.0.0",
"chai": "^5.1.1",
"chai": "^4.5.0",
"clean-webpack-plugin": "^4.0.0",
"copy-webpack-plugin": "^11.0.0",
"del": "^7.0.0",
@@ -93,8 +93,8 @@
"rimraf": "^6.0.1",
"sass": "^1.77.8",
"shelljs": "^0.8.5",
"sinon": "^18.0.0",
"sinon-chai": "^4.0.0",
"sinon": "^15.2.0",
"sinon-chai": "^3.7.0",
"sinon-chrome": "^3.0.1",
"ts-jest": "^29.2.5",
"ts-loader": "^9.5.1",
@@ -6058,13 +6058,13 @@
}
},
"node_modules/assertion-error": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz",
"integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==",
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz",
"integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=12"
"node": "*"
}
},
"node_modules/ast-types": {
@@ -6145,9 +6145,9 @@
}
},
"node_modules/axios": {
"version": "1.7.5",
"resolved": "https://registry.npmjs.org/axios/-/axios-1.7.5.tgz",
"integrity": "sha512-fZu86yCo+svH3uqJ/yTdQ0QHpQu5oL+/QE+QPSv6BZSkDAoky9vytxp7u5qk83OJFS3kEBcesWni9WTZAv3tSw==",
"version": "1.7.6",
"resolved": "https://registry.npmjs.org/axios/-/axios-1.7.6.tgz",
"integrity": "sha512-Ekur6XDwhnJ5RgOCaxFnXyqlPALI3rVeukZMwOdfghW7/wGz784BYKiQq+QD8NPcr91KRo30KfHOchyijwWw7g==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -7102,20 +7102,32 @@
"license": "CC-BY-4.0"
},
"node_modules/chai": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/chai/-/chai-5.1.1.tgz",
"integrity": "sha512-pT1ZgP8rPNqUgieVaEY+ryQr6Q4HXNg8Ei9UnLUrjN4IA7dvQC5JB+/kxVcPNDHyBcc/26CXPkbNzq3qwrOEKA==",
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/chai/-/chai-4.5.0.tgz",
"integrity": "sha512-RITGBfijLkBddZvnn8jdqoTypxvqbOLYQkGGxXzeFjVHvudaPw0HNFD9x928/eUwYWd2dPCugVqspGALTZZQKw==",
"dev": true,
"license": "MIT",
"dependencies": {
"assertion-error": "^2.0.1",
"check-error": "^2.1.1",
"deep-eql": "^5.0.1",
"loupe": "^3.1.0",
"pathval": "^2.0.0"
"assertion-error": "^1.1.0",
"check-error": "^1.0.3",
"deep-eql": "^4.1.3",
"get-func-name": "^2.0.2",
"loupe": "^2.3.6",
"pathval": "^1.1.1",
"type-detect": "^4.1.0"
},
"engines": {
"node": ">=12"
"node": ">=4"
}
},
"node_modules/chai/node_modules/type-detect": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.1.0.tgz",
"integrity": "sha512-Acylog8/luQ8L7il+geoSxhEkazvkslg7PSNKOX59mbB9cOveP5aq9h74Y7YU8yDpJwetzQQrfIwtf4Wp4LKcw==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=4"
}
},
"node_modules/chalk": {
@@ -7230,13 +7242,16 @@
}
},
"node_modules/check-error": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/check-error/-/check-error-2.1.1.tgz",
"integrity": "sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw==",
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.3.tgz",
"integrity": "sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==",
"dev": true,
"license": "MIT",
"dependencies": {
"get-func-name": "^2.0.2"
},
"engines": {
"node": ">= 16"
"node": "*"
}
},
"node_modules/cheerio": {
@@ -8806,11 +8821,14 @@
"license": "MIT"
},
"node_modules/deep-eql": {
"version": "5.0.2",
"resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-5.0.2.tgz",
"integrity": "sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==",
"version": "4.1.4",
"resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.4.tgz",
"integrity": "sha512-SUwdGfqdKOwxCPeVYjwSyRpJ7Z+fhpwIAtmCUdZIWZ/YP5R9WAsyuSgpLVDi9bjWoN2LXHNss/dk3urXtdQxGg==",
"dev": true,
"license": "MIT",
"dependencies": {
"type-detect": "^4.0.0"
},
"engines": {
"node": ">=6"
}
@@ -17753,9 +17771,9 @@
}
},
"node_modules/loupe": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/loupe/-/loupe-3.1.1.tgz",
"integrity": "sha512-edNu/8D5MKVfGVFRhFf8aAxiTM6Wumfz5XsaatSxlD3w4R1d/WEKUTydCdPGbl9K7QG/Ca3GnDV2sIKIpXRQcw==",
"version": "2.3.7",
"resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.7.tgz",
"integrity": "sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -18659,9 +18677,9 @@
"license": "MIT"
},
"node_modules/nise": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/nise/-/nise-6.0.0.tgz",
"integrity": "sha512-K8ePqo9BFvN31HXwEtTNGzgrPpmvgciDsFz8aztFjt4LqKO/JeFD8tBOeuDiCMXrIl/m1YvfH8auSpxfaD09wg==",
"version": "5.1.9",
"resolved": "https://registry.npmjs.org/nise/-/nise-5.1.9.tgz",
"integrity": "sha512-qOnoujW4SV6e40dYxJOb3uvuoPHtmLzIk4TFo+j0jPJoC+5Z9xja5qH5JZobEPsa8+YYphMrOSwnrshEhG2qww==",
"dev": true,
"license": "BSD-3-Clause",
"dependencies": {
@@ -19598,13 +19616,13 @@
}
},
"node_modules/pathval": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/pathval/-/pathval-2.0.0.tgz",
"integrity": "sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA==",
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz",
"integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">= 14.16"
"node": "*"
}
},
"node_modules/pbkdf2": {
@@ -21638,18 +21656,19 @@
"license": "MIT"
},
"node_modules/sinon": {
"version": "18.0.0",
"resolved": "https://registry.npmjs.org/sinon/-/sinon-18.0.0.tgz",
"integrity": "sha512-+dXDXzD1sBO6HlmZDd7mXZCR/y5ECiEiGCBSGuFD/kZ0bDTofPYc6JaeGmPSF+1j1MejGUWkORbYOLDyvqCWpA==",
"version": "15.2.0",
"resolved": "https://registry.npmjs.org/sinon/-/sinon-15.2.0.tgz",
"integrity": "sha512-nPS85arNqwBXaIsFCkolHjGIkFo+Oxu9vbgmBJizLAhqe6P2o3Qmj3KCUoRkfhHtvgDhZdWD3risLHAUJ8npjw==",
"deprecated": "16.1.1",
"dev": true,
"license": "BSD-3-Clause",
"dependencies": {
"@sinonjs/commons": "^3.0.1",
"@sinonjs/fake-timers": "^11.2.2",
"@sinonjs/commons": "^3.0.0",
"@sinonjs/fake-timers": "^10.3.0",
"@sinonjs/samsam": "^8.0.0",
"diff": "^5.2.0",
"nise": "^6.0.0",
"supports-color": "^7"
"diff": "^5.1.0",
"nise": "^5.1.4",
"supports-color": "^7.2.0"
},
"funding": {
"type": "opencollective",
@@ -21657,13 +21676,13 @@
}
},
"node_modules/sinon-chai": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/sinon-chai/-/sinon-chai-4.0.0.tgz",
"integrity": "sha512-cWqO7O2I4XfJDWyWElAQ9D/dtdh5Mo0RHndsfiiYyjWnlPzBJdIvjCVURO4EjyYaC3BjV+ISNXCfTXPXTEIEWA==",
"version": "3.7.0",
"resolved": "https://registry.npmjs.org/sinon-chai/-/sinon-chai-3.7.0.tgz",
"integrity": "sha512-mf5NURdUaSdnatJx3uhoBOrY9dtL19fiOtAdT1Azxg3+lNJFiuN0uzaU3xX1LeAfL17kHQhTAJgpsfhbMJMY2g==",
"dev": true,
"license": "(BSD-2-Clause OR WTFPL)",
"peerDependencies": {
"chai": "^5.0.0",
"chai": "^4.0.0",
"sinon": ">=4.0.0"
}
},
@@ -21776,16 +21795,6 @@
"supports-color": "^5.5.0"
}
},
"node_modules/sinon/node_modules/@sinonjs/fake-timers": {
"version": "11.3.1",
"resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-11.3.1.tgz",
"integrity": "sha512-EVJO7nW5M/F5Tur0Rf2z/QoMo+1Ia963RiMtapiQrEWvY0iBUvADo8Beegwjpnle5BHkyHuoxSTW3jF43H1XRA==",
"dev": true,
"license": "BSD-3-Clause",
"dependencies": {
"@sinonjs/commons": "^3.0.1"
}
},
"node_modules/sinon/node_modules/has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
@@ -24183,9 +24192,9 @@
}
},
"node_modules/webextension-polyfill": {
"version": "0.12.0",
"resolved": "https://registry.npmjs.org/webextension-polyfill/-/webextension-polyfill-0.12.0.tgz",
"integrity": "sha512-97TBmpoWJEE+3nFBQ4VocyCdLKfw54rFaJ6EVQYLBCXqCIpLSZkwGgASpv4oPt9gdKCJ80RJlcmNzNn008Ag6Q==",
"version": "0.10.0",
"resolved": "https://registry.npmjs.org/webextension-polyfill/-/webextension-polyfill-0.10.0.tgz",
"integrity": "sha512-c5s35LgVa5tFaHhrZDnr3FpQpjj1BB+RXhLTYUxGqBVN460HkbM8TBtEqdXWbpTKfzwCcjAZVF7zXCYSKtcp9g==",
"license": "MPL-2.0"
},
"node_modules/webidl-conversions": {

View File

@@ -45,7 +45,7 @@
"react-transition-group": "^4.4.5",
"redux-logger": "^4.0.0",
"uuid": "^10.0.0",
"webextension-polyfill": "^0.12.0"
"webextension-polyfill": "^0.10.0"
},
"devDependencies": {
"@babel/core": "^7.25.2",
@@ -81,7 +81,7 @@
"babel-jest": "^29.7.0",
"babel-loader": "^9.1.3",
"browserify": "^17.0.0",
"chai": "^5.1.1",
"chai": "^4.5.0",
"clean-webpack-plugin": "^4.0.0",
"copy-webpack-plugin": "^11.0.0",
"del": "^7.0.0",
@@ -114,8 +114,8 @@
"rimraf": "^6.0.1",
"sass": "^1.77.8",
"shelljs": "^0.8.5",
"sinon": "^18.0.0",
"sinon-chai": "^4.0.0",
"sinon": "^15.2.0",
"sinon-chai": "^3.7.0",
"sinon-chrome": "^3.0.1",
"ts-jest": "^29.2.5",
"ts-loader": "^9.5.1",

View File

@@ -1,15 +1,16 @@
import React from 'react';
import { Browser } from 'webextension-polyfill';
import { renderWithProviders } from '../utils/test-utils';
import MainList from './MainList';
jest.mock<typeof import('webextension-polyfill')>('webextension-polyfill', () => {
return {
runtime: {
getManifest: () => {
return { version: 'test-version' };
getManifest: () => ({
version: 'test-version',
}),
},
},
};
} as Browser;
});
describe('MainList', () => {

View File

@@ -1,4 +1,5 @@
import React from 'react';
import { Browser } from 'webextension-polyfill';
import { renderWithProviders } from '../utils/test-utils';
import NavBar from './NavBar';
@@ -9,7 +10,7 @@ jest.mock<typeof import('webextension-polyfill')>('webextension-polyfill', () =>
return { version: 'test-version' };
},
},
};
} as Browser;
});
describe('NavBar', () => {

View File

@@ -1,3 +1,4 @@
import { Browser } from 'webextension-polyfill';
import config from './config';
jest.mock<typeof import('webextension-polyfill')>('webextension-polyfill', () => {
@@ -7,7 +8,7 @@ jest.mock<typeof import('webextension-polyfill')>('webextension-polyfill', () =>
return { version: 'test-version' };
},
},
};
} as Browser;
});
describe('wakatime config', () => {
@@ -68,6 +69,7 @@ describe('wakatime config', () => {
"tiktok.com",
"twitter.com",
"whatsapp.com",
"x.com",
"youtube.com",
],
"states": [

View File

@@ -1,11 +1,8 @@
import chai from 'chai';
import sinon from 'sinon';
const sinon = require('sinon/pkg/sinon.js');
import chrome from 'sinon-chrome';
const expect = chai.expect;
describe('Chrome Dev Tools', function () {
it('should work', function () {
it('should work', async function () {
chrome.browserAction.setTitle({ title: 'hello' });
sinon.assert.calledOnce(chrome.browserAction.setTitle);
});