Fix up tests after rebase.

Signed-off-by: Eric Peterson <ericpeterson@spotify.com>
This commit is contained in:
Eric Peterson
2021-11-12 12:36:03 +01:00
committed by Eric Peterson
parent 6e618bef06
commit 12157e8f5b
4 changed files with 59 additions and 18 deletions
+1 -2
View File
@@ -112,8 +112,7 @@ techdocs:
# pullImage: true # or false to disable automatic pulling of image (e.g. if custom docker login is required)
publisher:
type: 'local' # Alternatives - 'googleGcs' or 'awsS3' or 'azureBlobStorage' or 'openStackSwift'. Read documentation for using alternatives.
cache:
ttl: 3600000 # 1 hour cache for demonstration purposes. You may wish to set this higher in production.
sentry:
organization: my-company
@@ -150,21 +150,39 @@ describe('AwsS3Publish', () => {
describe('publish', () => {
it('should publish a directory', async () => {
const publisher = createPublisherFromConfig();
expect(await publisher.publish({ entity, directory })).toBeUndefined();
expect(await publisher.publish({ entity, directory })).toMatchObject({
objects: expect.arrayContaining([
'default/component/backstage/404.html',
`default/component/backstage/index.html`,
`default/component/backstage/assets/main.css`,
]),
});
});
it('should publish a directory as well when legacy casing is used', async () => {
const publisher = createPublisherFromConfig({
legacyUseCaseSensitiveTripletPaths: true,
});
expect(await publisher.publish({ entity, directory })).toBeUndefined();
expect(await publisher.publish({ entity, directory })).toMatchObject({
objects: expect.arrayContaining([
'default/Component/backstage/404.html',
`default/Component/backstage/index.html`,
`default/Component/backstage/assets/main.css`,
]),
});
});
it('should publish a directory when root path is specified', async () => {
const publisher = createPublisherFromConfig({
bucketRootPath: 'backstage-data/techdocs',
});
expect(await publisher.publish({ entity, directory })).toBeUndefined();
expect(await publisher.publish({ entity, directory })).toMatchObject({
objects: expect.arrayContaining([
'backstage-data/techdocs/default/component/backstage/404.html',
`backstage-data/techdocs/default/component/backstage/index.html`,
`backstage-data/techdocs/default/component/backstage/assets/main.css`,
]),
});
});
it('should publish a directory when root path is specified and legacy casing is used', async () => {
@@ -174,9 +192,9 @@ describe('AwsS3Publish', () => {
});
expect(await publisher.publish({ entity, directory })).toMatchObject({
objects: expect.arrayContaining([
'test-namespace/TestKind/test-component-name/404.html',
`test-namespace/TestKind/test-component-name/index.html`,
`test-namespace/TestKind/test-component-name/assets/main.css`,
'backstage-data/techdocs/default/Component/backstage/404.html',
`backstage-data/techdocs/default/Component/backstage/index.html`,
`backstage-data/techdocs/default/Component/backstage/assets/main.css`,
]),
});
});
@@ -155,7 +155,13 @@ describe('AzureBlobStoragePublish', () => {
describe('publish', () => {
it('should publish a directory', async () => {
const publisher = createPublisherFromConfig();
expect(await publisher.publish({ entity, directory })).toBeUndefined();
expect(await publisher.publish({ entity, directory })).toMatchObject({
objects: expect.arrayContaining([
'default/component/backstage/404.html',
`default/component/backstage/index.html`,
`default/component/backstage/assets/main.css`,
]),
});
});
it('should publish a directory as well when legacy casing is used', async () => {
@@ -164,9 +170,9 @@ describe('AzureBlobStoragePublish', () => {
});
expect(await publisher.publish({ entity, directory })).toMatchObject({
objects: expect.arrayContaining([
'test-namespace/TestKind/test-component-name/404.html',
`test-namespace/TestKind/test-component-name/index.html`,
`test-namespace/TestKind/test-component-name/assets/main.css`,
'default/Component/backstage/404.html',
`default/Component/backstage/index.html`,
`default/Component/backstage/assets/main.css`,
]),
});
});
@@ -143,21 +143,39 @@ describe('GoogleGCSPublish', () => {
describe('publish', () => {
it('should publish a directory', async () => {
const publisher = createPublisherFromConfig();
expect(await publisher.publish({ entity, directory })).toBeUndefined();
expect(await publisher.publish({ entity, directory })).toMatchObject({
objects: expect.arrayContaining([
'default/component/backstage/404.html',
`default/component/backstage/index.html`,
`default/component/backstage/assets/main.css`,
]),
});
});
it('should publish a directory as well when legacy casing is used', async () => {
const publisher = createPublisherFromConfig({
legacyUseCaseSensitiveTripletPaths: true,
});
expect(await publisher.publish({ entity, directory })).toBeUndefined();
expect(await publisher.publish({ entity, directory })).toMatchObject({
objects: expect.arrayContaining([
'default/Component/backstage/404.html',
`default/Component/backstage/index.html`,
`default/Component/backstage/assets/main.css`,
]),
});
});
it('should publish a directory when root path is specified', async () => {
const publisher = createPublisherFromConfig({
bucketRootPath: 'backstage-data/techdocs',
});
expect(await publisher.publish({ entity, directory })).toBeUndefined();
expect(await publisher.publish({ entity, directory })).toMatchObject({
objects: expect.arrayContaining([
'backstage-data/techdocs/default/component/backstage/404.html',
`backstage-data/techdocs/default/component/backstage/index.html`,
`backstage-data/techdocs/default/component/backstage/assets/main.css`,
]),
});
});
it('should publish a directory when root path is specified and legacy casing is used', async () => {
@@ -167,9 +185,9 @@ describe('GoogleGCSPublish', () => {
});
expect(await publisher.publish({ entity, directory })).toMatchObject({
objects: expect.arrayContaining([
'test-namespace/TestKind/test-component-name/404.html',
`test-namespace/TestKind/test-component-name/index.html`,
`test-namespace/TestKind/test-component-name/assets/main.css`,
'backstage-data/techdocs/default/Component/backstage/404.html',
`backstage-data/techdocs/default/Component/backstage/index.html`,
`backstage-data/techdocs/default/Component/backstage/assets/main.css`,
]),
});
});