Skip to content

Commit

Permalink
fix(test): fix unresolved promises (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
ykzts authored Feb 24, 2023
1 parent 8f82ec1 commit 2c4ac50
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 138 deletions.
4 changes: 2 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
}
},
"forwardPorts": [3000],
"image": "mcr.microsoft.com/vscode/devcontainers/typescript-node:0-18-bullseye",
"image": "mcr.microsoft.com/devcontainers/typescript-node:0-18-bullseye",
"name": "Edge Sitemap",
"postCreateCommand": "sudo corepack enable && pnpm install",
"remoteUser": "vscode"
"remoteUser": "node"
}
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default {
testEnvironment: '@edge-runtime/jest-environment',
testEnvironment: 'node',
transform: {},
}
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
},
"description": "Generator of Sitemaps using web standard technology for operation in Edge Computing.",
"devDependencies": {
"@edge-runtime/jest-environment": "^2.0.5",
"@jest/globals": "^29.4.3",
"@typescript-eslint/eslint-plugin": "^5.53.0",
"@typescript-eslint/parser": "^5.53.0",
Expand Down
128 changes: 0 additions & 128 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 18 additions & 2 deletions src/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`basic use case 1`] = `Promise {}`;
exports[`basic use case 1`] = `
"<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url><loc>https://example.com/</loc><priority>1.0</priority></url><url><loc>https://example.com/privacy</loc><priority>0.1</priority></url></urlset>"
`;

exports[`pretty results 1`] = `Promise {}`;
exports[`pretty results 1`] = `
"<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://example.com/</loc>
<priority>1.0</priority>
</url>
<url>
<loc>https://example.com/privacy</loc>
<priority>0.1</priority>
</url>
</urlset>
"
`;
8 changes: 4 additions & 4 deletions src/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ async function readableStreamToString(readableStream) {
return result
}

test('basic use case', async () => {
test('basic use case', () => {
const { readable, writable } = new SitemapStream({
baseURL: 'https://example.com/',
})
Expand All @@ -61,10 +61,10 @@ test('basic use case', async () => {
writable
)

expect(readableStreamToString(readable)).toMatchSnapshot()
return expect(readableStreamToString(readable)).resolves.toMatchSnapshot()
})

test('pretty results', async () => {
test('pretty results', () => {
const { readable, writable } = new SitemapStream({
baseURL: 'https://example.com/',
pretty: true,
Expand All @@ -84,5 +84,5 @@ test('pretty results', async () => {
writable
)

expect(readableStreamToString(readable)).toMatchSnapshot()
return expect(readableStreamToString(readable)).resolves.toMatchSnapshot()
})

0 comments on commit 2c4ac50

Please sign in to comment.