Skip to content

Commit

Permalink
Moved fixture to test folder
Browse files Browse the repository at this point in the history
  • Loading branch information
petruki committed May 6, 2024
1 parent f188d53 commit 424dbad
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 16 deletions.
18 changes: 16 additions & 2 deletions jsr.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
{
"name": "@switcherapi/switcher-client-js",
"version": "4.0.4",
"exports": "./switcher-client.js"
"version": "4.0.5",
"exports": "./switcher-client.js",
"publish": {
"include": [
"LICENSE",
"switcher-client.js",
"src/**/*"
],
"exclude": [
".github",
".vscode",
"test",
"sonar-project.properties",
".snyk"
]
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "switcher-client",
"version": "4.0.4",
"version": "4.0.5",
"description": "Client JS SDK for working with Switcher-API",
"main": "./switcher-client.js",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
sonar.projectKey=switcherapi_switcher-client-master
sonar.projectName=switcher-client-js
sonar.organization=switcherapi
sonar.projectVersion=4.0.4
sonar.projectVersion=4.0.5
sonar.links.homepage=https://github.com/switcherapi/switcher-client-js

sonar.javascript.lcov.reportPaths=coverage/lcov.info
Expand Down
1 change: 1 addition & 0 deletions src/declarations.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare module '@switcherapi/switcher-client-js';
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion test/switcher-client.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('E2E test - Switcher local:', function () {
};

const options = {
snapshotLocation: './snapshot/',
snapshotLocation: './test/snapshot/',
local: true,
logger: true,
regexMaxBlackList: 1,
Expand Down
12 changes: 6 additions & 6 deletions test/switcher-functional.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('Integrated test - Switcher:', function () {
let contextSettings;

this.afterAll(function() {
unwatchFile('./snapshot/default.json');
unwatchFile('./test/snapshot/default.json');
});

this.beforeEach(function() {
Expand Down Expand Up @@ -198,7 +198,7 @@ describe('Integrated test - Switcher:', function () {

const forceRemoteOptions = {
local: true,
snapshotLocation: './snapshot/',
snapshotLocation: './test/snapshot/',
regexSafe: false
};

Expand Down Expand Up @@ -307,7 +307,7 @@ describe('Integrated test - Switcher:', function () {
given(fetchStub, 0, { status: 429 });

//test
Switcher.buildContext(contextSettings, { silentMode: '5m', regexSafe: false, snapshotLocation: './snapshot/' });
Switcher.buildContext(contextSettings, { silentMode: '5m', regexSafe: false, snapshotLocation: './test/snapshot/' });
await Switcher.checkSwitchers(['FEATURE01', 'FEATURE02']).catch(e => {
assert.equal(e.message, 'Something went wrong: [FEATURE01,FEATURE02] not found');
});
Expand All @@ -322,7 +322,7 @@ describe('Integrated test - Switcher:', function () {

// test
let asyncErrorMessage = null;
Switcher.buildContext(contextSettings, { silentMode: '5m', regexSafe: false, snapshotLocation: './snapshot/' });
Switcher.buildContext(contextSettings, { silentMode: '5m', regexSafe: false, snapshotLocation: './test/snapshot/' });
Switcher.subscribeNotifyError((error) => asyncErrorMessage = error.message);

const switcher = Switcher.factory();
Expand Down Expand Up @@ -590,7 +590,7 @@ describe('Integrated test - Switcher:', function () {

// setup context to read the snapshot in case the API does not respond
Switcher.buildContext(contextSettings, {
snapshotLocation: './snapshot/',
snapshotLocation: './test/snapshot/',
regexSafe: false,
silentMode: '2s'
});
Expand Down Expand Up @@ -642,7 +642,7 @@ describe('Integrated test - Switcher:', function () {

// test
Switcher.buildContext(contextSettings, {
snapshotLocation: './snapshot/',
snapshotLocation: './test/snapshot/',
regexSafe: false,
silentMode: '5m'
});
Expand Down
8 changes: 4 additions & 4 deletions test/switcher-snapshot.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('E2E test - Switcher local - Snapshot:', function () {
const environment = 'dev';
const url = 'http://localhost:3000';

const dataBuffer = readFileSync('./snapshot/dev.json');
const dataBuffer = readFileSync('./test/snapshot/dev.json');
const dataJSON = dataBuffer.toString();

let fetchStub;
Expand All @@ -29,7 +29,7 @@ describe('E2E test - Switcher local - Snapshot:', function () {

beforeEach(function() {
Switcher.buildContext({ url, apiKey, domain, component, environment }, {
snapshotLocation: './snapshot/',
snapshotLocation: './test/snapshot/',
local: true,
regexSafe: false
});
Expand Down Expand Up @@ -256,10 +256,10 @@ describe('E2E test - Snapshot AutoUpdater:', function () {
const environment = 'dev';
const url = 'http://localhost:3000';

const dataBuffer = readFileSync('./snapshot/dev.json');
const dataBuffer = readFileSync('./test/snapshot/dev.json');
const dataJSON = dataBuffer.toString();

const dataBufferV2 = readFileSync('./snapshot/dev_v2.json');
const dataBufferV2 = readFileSync('./test/snapshot/dev_v2.json');
const dataJSONV2 = dataBufferV2.toString();

let fetchStub;
Expand Down
2 changes: 1 addition & 1 deletion test/switcher-watch-snapshot.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('E2E test - Switcher local - Watch Snapshot:', function () {
mkdirSync('generated-snapshots/', { recursive: true });
}

const dataBuffer = readFileSync('./snapshot/dev.json');
const dataBuffer = readFileSync('./test/snapshot/dev.json');
devJSON = JSON.parse(dataBuffer.toString());
devJSON.data.domain.group[0].config[0].activated = true;
});
Expand Down
6 changes: 6 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"include": [
"src/**/*",
"src/declarations.d.ts"
]
}

0 comments on commit 424dbad

Please sign in to comment.