Skip to content

Commit 62dc2f9

Browse files
committed
added tests for util functions
1 parent 9bab868 commit 62dc2f9

File tree

9 files changed

+6754
-528
lines changed

9 files changed

+6754
-528
lines changed

jest.config.mjs

Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
/*
2+
* For a detailed explanation regarding each configuration property, visit:
3+
* https://jestjs.io/docs/configuration
4+
*/
5+
6+
export default {
7+
// All imported modules in your tests should be mocked automatically
8+
// automock: false,
9+
10+
// Stop running tests after `n` failures
11+
// bail: 0,
12+
13+
// The directory where Jest should store its cached dependency information
14+
// cacheDirectory: "/tmp/jest_rs",
15+
16+
// Automatically clear mock calls, instances and results before every test
17+
clearMocks: true,
18+
19+
// Indicates whether the coverage information should be collected while executing the test
20+
collectCoverage: true,
21+
22+
// An array of glob patterns indicating a set of files for which coverage information should be collected
23+
// collectCoverageFrom: undefined,
24+
25+
// The directory where Jest should output its coverage files
26+
coverageDirectory: 'coverage',
27+
28+
// An array of regexp pattern strings used to skip coverage collection
29+
coveragePathIgnorePatterns: [
30+
'/node_modules/',
31+
'/tests/helper/',
32+
'/lib/constant.js',
33+
],
34+
35+
// Indicates which provider should be used to instrument code for coverage
36+
coverageProvider: 'v8',
37+
38+
// A list of reporter names that Jest uses when writing coverage reports
39+
// coverageReporters: [
40+
// "json",
41+
// "text",
42+
// "lcov",
43+
// "clover"
44+
// ],
45+
46+
// An object that configures minimum threshold enforcement for coverage results
47+
// coverageThreshold: undefined,
48+
49+
// A path to a custom dependency extractor
50+
// dependencyExtractor: undefined,
51+
52+
// Make calling deprecated APIs throw helpful error messages
53+
// errorOnDeprecated: false,
54+
55+
// Force coverage collection from ignored files using an array of glob patterns
56+
// forceCoverageMatch: [],
57+
58+
// A path to a module which exports an async function that is triggered once before all test suites
59+
// globalSetup: undefined,
60+
61+
// A path to a module which exports an async function that is triggered once after all test suites
62+
// globalTeardown: undefined,
63+
64+
// A set of global variables that need to be available in all test environments
65+
// globals: {},
66+
67+
// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
68+
// maxWorkers: "50%",
69+
70+
// An array of directory names to be searched recursively up from the requiring module's location
71+
// moduleDirectories: [
72+
// "node_modules"
73+
// ],
74+
75+
// An array of file extensions your modules use
76+
// moduleFileExtensions: [
77+
// "js",
78+
// "jsx",
79+
// "ts",
80+
// "tsx",
81+
// "json",
82+
// "node"
83+
// ],
84+
85+
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
86+
// moduleNameMapper: {},
87+
88+
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
89+
// modulePathIgnorePatterns: [],
90+
91+
// Activates notifications for test results
92+
// notify: false,
93+
94+
// An enum that specifies notification mode. Requires { notify: true }
95+
// notifyMode: "failure-change",
96+
97+
// A preset that is used as a base for Jest's configuration
98+
// preset: undefined,
99+
100+
// Run tests from one or more projects
101+
// projects: undefined,
102+
103+
// Use this configuration option to add custom reporters to Jest
104+
// reporters: undefined,
105+
106+
// Automatically reset mock state before every test
107+
// resetMocks: false,
108+
109+
// Reset the module registry before running each individual test
110+
// resetModules: false,
111+
112+
// A path to a custom resolver
113+
// resolver: undefined,
114+
115+
// Automatically restore mock state and implementation before every test
116+
// restoreMocks: false,
117+
118+
// The root directory that Jest should scan for tests and modules within
119+
// rootDir: undefined,
120+
121+
// A list of paths to directories that Jest should use to search for files in
122+
// roots: [
123+
// "<rootDir>"
124+
// ],
125+
126+
// Allows you to use a custom runner instead of Jest's default test runner
127+
// runner: "jest-runner",
128+
129+
// The paths to modules that run some code to configure or set up the testing environment before each test
130+
// setupFiles: [],
131+
132+
// A list of paths to modules that run some code to configure or set up the testing framework before each test
133+
// setupFilesAfterEnv: [],
134+
135+
// The number of seconds after which a test is considered as slow and reported as such in the results.
136+
// slowTestThreshold: 5,
137+
138+
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
139+
// snapshotSerializers: [],
140+
141+
// The test environment that will be used for testing
142+
// testEnvironment: "jest-environment-node",
143+
144+
// Options that will be passed to the testEnvironment
145+
// testEnvironmentOptions: {},
146+
147+
// Adds a location field to test results
148+
// testLocationInResults: false,
149+
150+
// The glob patterns Jest uses to detect test files
151+
// testMatch: [
152+
// "**/__tests__/**/*.[jt]s?(x)",
153+
// "**/?(*.)+(spec|test).[tj]s?(x)"
154+
// ],
155+
156+
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
157+
// testPathIgnorePatterns: [
158+
// "/node_modules/"
159+
// ],
160+
161+
// The regexp pattern or array of patterns that Jest uses to detect test files
162+
// testRegex: [],
163+
164+
// This option allows the use of a custom results processor
165+
// testResultsProcessor: undefined,
166+
167+
// This option allows use of a custom test runner
168+
// testRunner: "jest-circus/runner",
169+
170+
// This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
171+
// testURL: "http://localhost",
172+
173+
// Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
174+
// timers: "real",
175+
176+
// A map from regular expressions to paths to transformers
177+
// transform: undefined,
178+
179+
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
180+
// transformIgnorePatterns: [
181+
// "/node_modules/",
182+
// "\\.pnp\\.[^\\/]+$"
183+
// ],
184+
185+
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
186+
// unmockedModulePathPatterns: undefined,
187+
188+
// Indicates whether each individual test should be reported during the run
189+
// verbose: undefined,
190+
191+
// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
192+
// watchPathIgnorePatterns: [],
193+
194+
// Whether to use watchman for file crawling
195+
// watchman: true,
196+
};

lib/functions.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

lib/main.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99
loginUser,
1010
logout,
1111
} from './api-functions.js';
12-
import { FORMAT_CHOICES } from './constant.js';
1312

1413
let userToken;
1514
let apiToken;

lib/util.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export function convertToDate(epoch) {
3636

3737
return epochNumber === 0
3838
? 'Never'
39-
: `${day < 10 ? '0' + month : '' + day}.${
39+
: `${day < 10 ? '0' + day : '' + day}.${
4040
month < 10 ? '0' + month : '' + month
4141
}.${year} ${hours < 10 ? '0' + hours : '' + hours}:${
4242
minutes < 10 ? '0' + minutes : '' + minutes

0 commit comments

Comments
 (0)