Skip to content

Commit

Permalink
refactor: changes formatting of various statements
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshi-automation authored and bcoe committed Jun 7, 2019
1 parent a8b581c commit b0abfe6
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 69 deletions.
4 changes: 1 addition & 3 deletions vision/samples/productSearch/products.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,7 @@ async function updateProductLabels(projectId, location, productId, key, value) {
console.log(`Product description: ${updatedProduct.description}`);
console.log(`Product category: ${updatedProduct.productCategory}`);
console.log(
`Product Labels: ${updatedProduct.productLabels[0].key}: ${
updatedProduct.productLabels[0].value
}`
`Product Labels: ${updatedProduct.productLabels[0].key}: ${updatedProduct.productLabels[0].value}`
);
// [END vision_product_search_update_product_labels]
}
Expand Down
4 changes: 1 addition & 3 deletions vision/samples/system-test/importProductSets.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ const testImportProductSets = {
describe(`import product sets`, () => {
it(`should import a Product Set`, async () => {
const output = execSync(
`${cmd} importProductSets "${testImportProductSets.projectId}" "${
testImportProductSets.location
}" "${testImportProductSets.gcsUri}"`
`${cmd} importProductSets "${testImportProductSets.projectId}" "${testImportProductSets.location}" "${testImportProductSets.gcsUri}"`
);
assert.match(output, /Processing done./);
});
Expand Down
8 changes: 2 additions & 6 deletions vision/samples/system-test/productSearch.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,14 @@ describe(`product search`, () => {

it(`should add product to product set`, async () => {
const output = execSync(
`${cmd} addProductToProductSet "${testProductSet.projectId}" "${
testProductSet.location
}" "${testProductSet.productId}" "${testProductSet.productSetId}"`
`${cmd} addProductToProductSet "${testProductSet.projectId}" "${testProductSet.location}" "${testProductSet.productId}" "${testProductSet.productSetId}"`
);
assert.match(output, /Product added to product set./);
});

it(`should remove a product from a product set`, async () => {
const output = execSync(
`${cmd} removeProductFromProductSet "${testProductSet.projectId}" "${
testProductSet.location
}" "${testProductSet.productId}" "${testProductSet.productSetId}"`
`${cmd} removeProductFromProductSet "${testProductSet.projectId}" "${testProductSet.location}" "${testProductSet.productId}" "${testProductSet.productSetId}"`
);
assert.match(output, /Product removed from product set./);
});
Expand Down
16 changes: 4 additions & 12 deletions vision/samples/system-test/productSets.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@ describe(`product sets`, () => {
testProductSet.createdProductSetPaths.push(newProductSetPath);

const output = execSync(
`${cmd} createProductSet "${testProductSet.projectId}" "${
testProductSet.location
}" "${newProductSetId}" "${testProductSet.productSetDisplayName}"`
`${cmd} createProductSet "${testProductSet.projectId}" "${testProductSet.location}" "${newProductSetId}" "${testProductSet.productSetDisplayName}"`
);

assert.match(output, new RegExp(`Product Set name: ${newProductSetPath}`));
Expand All @@ -109,9 +107,7 @@ describe(`product sets`, () => {

it(`should get product set`, async () => {
const output = execSync(
`${cmd} getProductSet "${testProductSet.projectId}" "${
testProductSet.location
}" "${testProductSet.productSetId}"`
`${cmd} getProductSet "${testProductSet.projectId}" "${testProductSet.location}" "${testProductSet.productSetId}"`
);

assert.match(
Expand All @@ -128,9 +124,7 @@ describe(`product sets`, () => {

it(`should list product sets`, async () => {
const output = execSync(
`${cmd} listProductSets "${testProductSet.projectId}" "${
testProductSet.location
}"`
`${cmd} listProductSets "${testProductSet.projectId}" "${testProductSet.location}"`
);

assert.match(
Expand All @@ -152,9 +146,7 @@ describe(`product sets`, () => {
assert.ok(productSet);

const output = execSync(
`${cmd} deleteProductSet "${testProductSet.projectId}" "${
testProductSet.location
}" "${testProductSet.productSetId}"`
`${cmd} deleteProductSet "${testProductSet.projectId}" "${testProductSet.location}" "${testProductSet.productSetId}"`
);

assert.match(output, /deleted/);
Expand Down
46 changes: 9 additions & 37 deletions vision/samples/system-test/products.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,7 @@ describe(`products`, () => {
assert.strictEqual(maybeProduct, false);

let output = execSync(
`${cmd} createProduct "${testProduct.projectId}" "${
testProduct.location
}" "${newProductId}" "${testProduct.productDisplayName}" "${
testProduct.productCategory
}"`
`${cmd} createProduct "${testProduct.projectId}" "${testProduct.location}" "${newProductId}" "${testProduct.productDisplayName}" "${testProduct.productCategory}"`
);

assert.match(output, new RegExp(`Product name: ${newProductPath}`));
Expand All @@ -106,9 +102,7 @@ describe(`products`, () => {
assert.ok(newProduct.productCategory === testProduct.productCategory);

output = execSync(
`${cmd} deleteProduct "${testProduct.projectId}" "${
testProduct.location
}" "${newProductId}"`
`${cmd} deleteProduct "${testProduct.projectId}" "${testProduct.location}" "${newProductId}"`
);
assert.match(output, /Product deleted./);
});
Expand All @@ -122,19 +116,13 @@ describe(`products`, () => {
);
assert.strictEqual(await getProductOrFalse(newProductPath), false);
let output = execSync(
`${cmd} createProduct "${testProduct.projectId}" "${
testProduct.location
}" "${newProductId}" "${testProduct.productDisplayName}" "${
testProduct.productCategory
}"`
`${cmd} createProduct "${testProduct.projectId}" "${testProduct.location}" "${newProductId}" "${testProduct.productDisplayName}" "${testProduct.productCategory}"`
);

assert.match(output, new RegExp(`Product name: ${newProductPath}`));

output = execSync(
`${cmd} getProduct "${testProduct.projectId}" "${
testProduct.location
}" "${newProductId}"`
`${cmd} getProduct "${testProduct.projectId}" "${testProduct.location}" "${newProductId}"`
);

assert.match(output, new RegExp(`Product name: ${newProductPath}`));
Expand All @@ -148,9 +136,7 @@ describe(`products`, () => {
assert.match(output, /Product labels:/);

output = execSync(
`${cmd} deleteProduct "${testProduct.projectId}" "${
testProduct.location
}" "${newProductId}"`
`${cmd} deleteProduct "${testProduct.projectId}" "${testProduct.location}" "${newProductId}"`
);
assert.match(output, /Product deleted./);
});
Expand All @@ -171,20 +157,12 @@ describe(`products`, () => {
newProductId
);
let output = execSync(
`${cmd} createProduct "${testProduct.projectId}" "${
testProduct.location
}" "${newProductId}" "${testProduct.productDisplayName}" "${
testProduct.productCategory
}"`
`${cmd} createProduct "${testProduct.projectId}" "${testProduct.location}" "${newProductId}" "${testProduct.productDisplayName}" "${testProduct.productCategory}"`
);

assert.match(output, new RegExp(`Product name: ${newProductPath}`));
output = execSync(
`${cmd} updateProductLabels "${testProduct.projectId}" "${
testProduct.location
}" "${newProductId}" "${testProduct.productKey}" "${
testProduct.productValue
}"`
`${cmd} updateProductLabels "${testProduct.projectId}" "${testProduct.location}" "${newProductId}" "${testProduct.productKey}" "${testProduct.productValue}"`
);

assert.match(
Expand Down Expand Up @@ -213,19 +191,13 @@ describe(`products`, () => {
);
assert.strictEqual(await getProductOrFalse(newProductPath), false);
let output = execSync(
`${cmd} createProduct "${testProduct.projectId}" "${
testProduct.location
}" "${newProductId}" "${testProduct.productDisplayName}" "${
testProduct.productCategory
}"`
`${cmd} createProduct "${testProduct.projectId}" "${testProduct.location}" "${newProductId}" "${testProduct.productDisplayName}" "${testProduct.productCategory}"`
);

assert.match(output, new RegExp(`Product name: ${newProductPath}`));

output = execSync(
`${cmd} deleteProduct "${testProduct.projectId}" "${
testProduct.location
}" "${newProductId}"`
`${cmd} deleteProduct "${testProduct.projectId}" "${testProduct.location}" "${newProductId}"`
);
assert.match(output, /Product deleted./);

Expand Down
10 changes: 2 additions & 8 deletions vision/samples/system-test/referenceImages.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,20 +73,14 @@ describe(`reference images`, () => {

it(`should create reference image`, async () => {
const output = execSync(
`${cmd} createReferenceImage "${testProduct.projectId}" "${
testProduct.location
}" "${testProduct.productId}" "${testProduct.productReferenceImageId}" "${
testProduct.productImageUri
}"`
`${cmd} createReferenceImage "${testProduct.projectId}" "${testProduct.location}" "${testProduct.productId}" "${testProduct.productReferenceImageId}" "${testProduct.productImageUri}"`
);
assert.match(output, /response.uri: gs:\/\//);
});

it(`should delete reference image`, async () => {
const output = execSync(
`${cmd} deleteReferenceImage "${testProduct.projectId}" "${
testProduct.location
}" "${testProduct.productId}" "${testProduct.productReferenceImageId}"`
`${cmd} deleteReferenceImage "${testProduct.projectId}" "${testProduct.location}" "${testProduct.productId}" "${testProduct.productReferenceImageId}"`
);

assert.match(output, /Reference image deleted from product./);
Expand Down

0 comments on commit b0abfe6

Please sign in to comment.