Skip to content

Commit

Permalink
chore: proper jest assert
Browse files Browse the repository at this point in the history
  • Loading branch information
shortcuts committed Aug 28, 2024
1 parent fcd67cb commit 16c752d
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,9 @@ describe('api', () => {
});

it('default `init` clients to the root `algoliasearch` credentials', async () => {
const abtestingClient = client.initAbtesting();
const analyticsClient = client.initAnalytics();
const personalizationClient = client.initPersonalization({
region: 'eu',
});
const abtestingClient = client.initAbtesting({options:{requester:echoRequester()}});
const analyticsClient = client.initAnalytics({options:{requester:echoRequester()}});
const personalizationClient = client.initPersonalization({region:'eu',options:{requester:echoRequester()}});

const res1 = (await abtestingClient.customGet({
path: 'abtestingClient',
Expand Down Expand Up @@ -185,15 +183,18 @@ describe('api', () => {
const abtestingClient = client.initAbtesting({
appId: 'appId1',
apiKey: 'apiKey1',
options:{requester: echoRequester()}
});
const analyticsClient = client.initAnalytics({
appId: 'appId2',
apiKey: 'apiKey2',
options:{requester: echoRequester()}
});
const personalizationClient = client.initPersonalization({
appId: 'appId3',
apiKey: 'apiKey3',
region: 'eu',
options:{requester: echoRequester()}
});

const res1 = (await abtestingClient.customGet({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,9 @@ describe('api', () => {
});

it('default `init` clients to the root `algoliasearch` credentials', async () => {
const abtestingClient = client.initAbtesting();
const analyticsClient = client.initAnalytics();
const personalizationClient = client.initPersonalization({
region: 'eu',
});
const abtestingClient = client.initAbtesting({options:{requester: echoRequester()}});
const analyticsClient = client.initAnalytics({options:{requester: echoRequester()}});
const personalizationClient = client.initPersonalization({region:'eu',options:{requester: echoRequester()}});

const res1 = (await abtestingClient.customGet({
path: 'abtestingClient',
Expand Down Expand Up @@ -184,15 +182,18 @@ describe('api', () => {
const abtestingClient = client.initAbtesting({
appId: 'appId1',
apiKey: 'apiKey1',
options:{requester: echoRequester()}
});
const analyticsClient = client.initAnalytics({
appId: 'appId2',
apiKey: 'apiKey2',
options:{requester: echoRequester()}
});
const personalizationClient = client.initPersonalization({
appId: 'appId3',
apiKey: 'apiKey3',
region: 'eu',
options:{requester: echoRequester()}
});

const res1 = (await abtestingClient.customGet({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
/** @type {import('jest').Config} */
module.exports = {
/** @type {import('jest').Config.InitialOptions} */
const baseConfig = {
preset: 'ts-jest',
roots: ['__tests__'],
moduleDirectories: ['../../node_modules'],
transform: {
"\\.[jt]sx?$": "babel-jest",
}
};
/** @type {import('jest').Config} */
module.exports = {
projects: [
{
...baseConfig,
testEnvironment: 'jsdom',
testPathIgnorePatterns: [ '__tests__/algoliasearch.node.test.ts' ],
},
{
...baseConfig,
testEnvironment: 'node',
testPathIgnorePatterns: [ '__tests__/algoliasearch.browser.test.ts' ],
},
],
};
24 changes: 24 additions & 0 deletions tests/output/javascript/jest.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/** @type {import('jest').Config.InitialOptions} */
const baseConfig = {
preset: 'ts-jest',
roots: ['src/__tests__'],
moduleDirectories: ['../../node_modules'],
transform: {
"\\.[jt]sx?$": "babel-jest",
}
};
/** @type {import('jest').Config} */
module.exports = {
projects: [
{
...baseConfig,
testEnvironment: 'jsdom',
testPathIgnorePatterns: [ '__tests__/algoliasearch.browser.test.ts' ],
},
{
...baseConfig,
testEnvironment: 'node',
testPathIgnorePatterns: [ '__tests__/algoliasearch.node.test.ts' ],
},
],
};

0 comments on commit 16c752d

Please sign in to comment.