fix(techdocs): broken windows tests

This commit is contained in:
Remi
2021-01-07 12:03:36 +01:00
parent 4bff4d123b
commit 33b1a43c77
3 changed files with 16 additions and 37 deletions
@@ -51,16 +51,9 @@ export class S3 {
});
}
putObject({ Key }: { Key: string }) {
return new Promise((resolve, reject) => {
if (
fs.existsSync(Key) &&
fs.readFileSync(Key).toString() === 'mock-error'
) {
reject('');
} else {
resolve('');
}
putObject() {
return new Promise(resolve => {
resolve('');
});
}
}
@@ -14,7 +14,6 @@
* limitations under the License.
*/
import mockFs from 'mock-fs';
import path from 'path';
import * as winston from 'winston';
import { ConfigReader } from '@backstage/config';
import { AwsS3Publish } from './awsS3';
@@ -46,7 +45,7 @@ const getEntityRootDir = (entity: Entity) => {
kind,
metadata: { namespace, name },
} = entity;
const entityRootDir = path.join(namespace as string, kind, name);
const entityRootDir = `${namespace}/${kind}/${name}`;
return entityRootDir;
};
@@ -102,12 +101,6 @@ describe('AwsS3Publish', () => {
});
it('should fail to publish a directory', async () => {
const wrongPathToGeneratedDirectory = path.join(
'wrong',
'path',
'to',
'generatedDirectory',
);
const entity = createMockEntity();
const entityRootDir = getEntityRootDir(entity);
@@ -124,13 +117,11 @@ describe('AwsS3Publish', () => {
await publisher
.publish({
entity,
directory: wrongPathToGeneratedDirectory,
directory: '/wrong/path/to/generatedDirectory',
})
.catch(error =>
expect(error).toEqual(
new Error(
`Unable to upload file(s) to AWS S3. Error Failed to read template directory: ENOENT, no such file or directory '${wrongPathToGeneratedDirectory}'`,
),
expect(error.message).toContain(
'Unable to upload file(s) to AWS S3. Error Failed to read template directory',
),
);
mockFs.restore();
+9 -14
View File
@@ -2261,11 +2261,9 @@
to-fast-properties "^2.0.0"
"@backstage/catalog-model@^0.2.0":
version "0.2.0"
resolved "https://registry.npmjs.org/@backstage/catalog-model/-/catalog-model-0.2.0.tgz#e3fe2a4ddeb6a9b6ec480c80cb2b9c39cb245576"
integrity sha512-Y1ocdRpBlxK/VrJQjHlQd0bgADECd1B2NRjwd8ss46ibT5hwLvMOfD80+Fa7oPLu0ktJrH4lq0pNIIJIml48zA==
version "0.6.0"
dependencies:
"@backstage/config" "^0.1.1"
"@backstage/config" "^0.1.2"
"@types/json-schema" "^7.0.5"
"@types/yup" "^0.29.8"
json-schema "^0.2.5"
@@ -2274,11 +2272,9 @@
yup "^0.29.3"
"@backstage/catalog-model@^0.3.0":
version "0.3.1"
resolved "https://registry.npmjs.org/@backstage/catalog-model/-/catalog-model-0.3.1.tgz#45d08e2f333c9c566b2bf2629fd707fe989bb404"
integrity sha512-9XhV7c4rmVW+Yzj2PiwTQ7DsegWGB3C4ELsDRExuEVZONdqNcC02cyJtrt3fT5F31ZS3tHkB9bMUymFOBLqUSA==
version "0.6.0"
dependencies:
"@backstage/config" "^0.1.1"
"@backstage/config" "^0.1.2"
"@types/json-schema" "^7.0.5"
"@types/yup" "^0.29.8"
json-schema "^0.2.5"
@@ -2287,17 +2283,16 @@
yup "^0.29.3"
"@backstage/core@^0.3.0":
version "0.3.2"
resolved "https://registry.npmjs.org/@backstage/core/-/core-0.3.2.tgz#a8209126d5076cf4a8b9bd632fe4e5e2edb62916"
integrity sha512-i5d+Wh8js4qEWoAsPY5L7HVSWpumr1OhfF2dUCGYdyW6AMqVJPca6+n6zp1Rg2CO+J9norp44XAVVCbyhtUpig==
version "0.4.3"
dependencies:
"@backstage/config" "^0.1.1"
"@backstage/core-api" "^0.2.1"
"@backstage/theme" "^0.2.1"
"@backstage/config" "^0.1.2"
"@backstage/core-api" "^0.2.8"
"@backstage/theme" "^0.2.2"
"@material-ui/core" "^4.11.0"
"@material-ui/icons" "^4.9.1"
"@material-ui/lab" "4.0.0-alpha.45"
"@types/dagre" "^0.7.44"
"@types/prop-types" "^15.7.3"
"@types/react" "^16.9"
"@types/react-sparklines" "^1.7.0"
classnames "^2.2.6"