Skip to content

Commit

Permalink
set timezone to UTC for tests and revert the last commit
Browse files Browse the repository at this point in the history
  • Loading branch information
bgptr committed Sep 16, 2021
1 parent a2fb322 commit 9ae28ee
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -5,8 +5,8 @@
"description": "Decrediton based on React, React Router, Webpack, React Hot Loader for rapid application development",
"main": "main.js",
"scripts": {
"test": "cross-env NODE_ENV=test jest",
"test-watch": "./node_modules/.bin/jest --watch",
"test": "TZ=UTC cross-env NODE_ENV=test jest",
"test-watch": "TZ=UTC ./node_modules/.bin/jest --watch",
"test-debug": "node --inspect-brk ./node_modules/jest/bin/jest.js --runInBand --watch",
"test-e2e": "cross-env NODE_ENV=test BABEL_DISABLE_CACHE=1 mocha --retries 2 --compilers js:@babel/register --require ./test/setup.js ./test/e2e.js",
"lint": "./node_modules/.bin/eslint app --ext .js --ext .jsx && ./node_modules/.bin/eslint test --ext .js && ./node_modules/.bin/stylelint 'app/**/*.css'",
Expand Down
16 changes: 10 additions & 6 deletions test/unit/components/views/LNPage/AdvancedTab.spec.js
Expand Up @@ -147,11 +147,15 @@ test("test infos", () => {
});

test("test backup", async () => {
expect(process.env.TZ).toBe("UTC");
render(<AdvancedTab />);
expect(screen.getByText(mockLnInfo.identityPubkey)).toBeInTheDocument();
expect(
screen.getByText(`SCB backup file location: ${mockLnSCBPath}`)
).toBeInTheDocument();
expect(
screen.getByText("Last Updated: 3/4/1975 12:51 PM")
).toBeInTheDocument();

const mockFilePath = "mockFilePath";
wallet.showSaveDialog.mockReturnValueOnce({ filePath: mockFilePath });
Expand Down Expand Up @@ -208,23 +212,23 @@ test("test query node", () => {
expect(mockGetNodeInfo).toHaveBeenCalledWith(mockNodeInfo.node.pubKey);
expect(
screen.getByText(mockNodeInfo.node.alias).parentElement.textContent
).toMatch(
/PubKey012121212121111111110101021001201201020120102102012010210201201201Aliasmock-node-aliasTotal Capacity107.8484888 DCR/i
).toMatchInlineSnapshot(
'"PubKey012121212121111111110101021001201201020120102102012010210201201201Aliasmock-node-aliasTotal Capacity107.8484888 DCRLast UpdateSep 8, 2021 11:16:37 PM"'
);

// first channel
expect(
screen.getByText(mockNodeInfo.channelsList[0].chanPoint).parentElement
.parentElement.parentElement.parentElement.textContent
).toMatch(
/Capacity10.00000 DCRChannel Pointmock-chanPoint-0(.*)Counterpartymock-node-1-pub-1Copy to clipboardPolicyNodeCounterpartyChan DisabledfalsefalseTimelock Delta8080Min HTLC0.00001 DCR0.00001 DCRMax HTLC9.90000 DCR9.90000 DCR/i
).toMatchInlineSnapshot(
'"Capacity10.00000 DCRChannel Pointmock-chanPoint-0Last UpdateSep 9, 2021 8:02:21 PMCounterpartymock-node-1-pub-1Copy to clipboardPolicyNodeCounterpartyChan DisabledfalsefalseTimelock Delta8080Min HTLC0.00001 DCR0.00001 DCRMax HTLC9.90000 DCR9.90000 DCRLast UpdateSep 7, 2021 3:16:37 PMSep 9, 2021 8:02:21 PM"'
);

// second channel
expect(
screen.getByText(mockNodeInfo.channelsList[1].chanPoint).parentElement
.parentElement.parentElement.parentElement.textContent
).toMatch(
/Capacity1.00000 DCRChannel Pointmock-chanPoint-1(.*)Counterpartymock-node-2-pub-1Copy to clipboardPolicyNodeCounterpartyChan DisabledtruefalseTimelock Delta8080Min HTLC0.00001 DCR0.00001 DCRMax HTLC0.99000 DCR0.99000 DCR/i
).toMatchInlineSnapshot(
'"Capacity1.00000 DCRChannel Pointmock-chanPoint-1Last UpdateSep 7, 2021 3:16:37 PMCounterpartymock-node-2-pub-1Copy to clipboardPolicyNodeCounterpartyChan DisabledtruefalseTimelock Delta8080Min HTLC0.00001 DCR0.00001 DCRMax HTLC0.99000 DCR0.99000 DCRLast UpdateSep 7, 2021 3:16:37 PMMar 21, 2020 10:42:26 PM"'
);
});

0 comments on commit 9ae28ee

Please sign in to comment.