This repository has been archived by the owner on Jul 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 182
test: make product search tests run #269
Merged
JustinBeckwith
merged 44 commits into
googleapis:master
from
nirupa-kumar:make-product-search-tests-run
Nov 29, 2018
Merged
Changes from 30 commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
ab03d7c
mv samples/productSearch/system-test/* samples/system-test/
58fb6e2
failing test fixes
nirupa-kumar 546fee9
failing test fixes
nirupa-kumar 600b8f2
failing test fixes
nirupa-kumar c74671a
failing test fixes
nirupa-kumar 01756a6
failing test fixes
nirupa-kumar 0037647
testing possible solutions for fix
nirupa-kumar 3914b5f
testing possible solutions for fix
nirupa-kumar dfc4b96
testing possible solutions for fix
nirupa-kumar 49c8fbf
testing possible solutions for fix
nirupa-kumar d8a7fb6
testing possible solutions for fix
nirupa-kumar 80d0320
testing possible solutions for fix
nirupa-kumar b71c6ea
testing possible solutions for fix
nirupa-kumar 19d5566
Merge branch 'master' of https://github.com/googleapis/nodejs-vision …
nirupa-kumar 4f33f59
testing possible solutions for fix
nirupa-kumar d33a41f
testing possible solutions for fix
nirupa-kumar cc0ee1b
testing possible solutions for fix
nirupa-kumar 7882a60
testing possible solutions for fix
nirupa-kumar 4aa9124
testing possible solutions for fix
nirupa-kumar a6692f4
testing possible solutions for fix
nirupa-kumar bbfa2c6
testing possible solutions for fix
nirupa-kumar 972b6d0
testing possible solutions for fix
nirupa-kumar 1e37d96
Merge branch 'master' of https://github.com/googleapis/nodejs-vision …
nirupa-kumar 06dc431
testing possible fixes
nirupa-kumar 949e940
testing possible solutions for fix
nirupa-kumar c7db6cf
testing possible solutions for fix
nirupa-kumar 2f95a1f
testing possible solutions for fix
nirupa-kumar 9ed5cf2
testing possible solutions for fix
nirupa-kumar 2a8075b
checking if import works within a reasonable timeframe now.
nirupa-kumar fb6084d
testing possible solutions for fix
nirupa-kumar b573c25
Merge branch 'master' into make-product-search-tests-run
JustinBeckwith 88ddb9d
Merge branch 'master' of https://github.com/googleapis/nodejs-vision …
nirupa-kumar a9a1d44
testing possible solutions for fix
nirupa-kumar 66a31b7
Merge remote-tracking branch 'origin/make-product-search-tests-run' i…
nirupa-kumar 33b92e5
testing possible solutions for fix
nirupa-kumar b9fa538
testing possible solutions for fix
nirupa-kumar 925bd50
testing possible solutions for fix
nirupa-kumar b27fae9
testing possible solutions for fix
nirupa-kumar 27c8201
testing possible fix for the face detection test failure
nirupa-kumar eec2183
fixing review comments
nirupa-kumar a438cee
fixing face Detection code
nirupa-kumar bf34885
fixing face Detection code
nirupa-kumar 0002d3e
fixing face Detection code
nirupa-kumar 87679cd
fixing face Detection code
nirupa-kumar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,88 +1,88 @@ | ||
/** | ||
* Copyright 2016, Google, Inc. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
const fs = require(`fs`); | ||
const path = require(`path`); | ||
const assert = require('assert'); | ||
const tools = require(`@google-cloud/nodejs-repo-tools`); | ||
|
||
class MockCanvas { | ||
getContext() { | ||
return { | ||
drawImage: () => {}, | ||
beginPath: () => {}, | ||
lineTo: () => {}, | ||
stroke: () => {}, | ||
}; | ||
} | ||
|
||
pngStream() { | ||
return { | ||
on: (event, cb) => { | ||
if (event === 'end') { | ||
setTimeout(cb, 1000); | ||
} else if (event === `data`) { | ||
/* eslint-disable */ | ||
cb(`test`); | ||
cb(`foo`); | ||
cb(`bar`); | ||
/* eslint-enable */ | ||
} | ||
}, | ||
}; | ||
} | ||
} | ||
|
||
MockCanvas.Image = class Image {}; | ||
|
||
const faceDetectionExample = require(`../faceDetection`); | ||
const inputFile = path.join(__dirname, `../resources`, `face.png`); | ||
const outputFile = path.join(__dirname, `../../vision`, `out.png`); | ||
nirupa-kumar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
describe(`face detection`, () => { | ||
before(tools.checkCredentials); | ||
before(tools.stubConsole); | ||
|
||
after(tools.restoreConsole); | ||
|
||
it(`should detect faces`, async () => { | ||
let done = false; | ||
const timeout = setTimeout(() => { | ||
if (!done) { | ||
console.warn('Face detection timed out!'); | ||
} | ||
}, 60); | ||
|
||
faceDetectionExample.main( | ||
inputFile, | ||
outputFile, | ||
MockCanvas, | ||
(err, faces) => { | ||
assert.ifError(err); | ||
assert.strictEqual(faces.length, 1); | ||
|
||
const image = fs.readFileSync(outputFile); | ||
assert.strictEqual(image.toString(`utf8`), `testfoobar`); | ||
assert.ok(console.log.calledWith(`Found 1 face`)); | ||
assert.ok(console.log.calledWith(`Highlighting...`)); | ||
assert.ok(console.log.calledWith(`Finished!`)); | ||
done = true; | ||
clearTimeout(timeout); | ||
} | ||
); | ||
}); | ||
}); | ||
// /** | ||
// * Copyright 2016, Google, Inc. | ||
// * Licensed under the Apache License, Version 2.0 (the "License"); | ||
// * you may not use this file except in compliance with the License. | ||
// * You may obtain a copy of the License at | ||
// * | ||
// * http://www.apache.org/licenses/LICENSE-2.0 | ||
// * | ||
// * Unless required by applicable law or agreed to in writing, software | ||
// * distributed under the License is distributed on an "AS IS" BASIS, | ||
// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// * See the License for the specific language governing permissions and | ||
// * limitations under the License. | ||
// */ | ||
// | ||
// 'use strict'; | ||
// | ||
// const fs = require(`fs`); | ||
// const path = require(`path`); | ||
// const assert = require('assert'); | ||
// const tools = require(`@google-cloud/nodejs-repo-tools`); | ||
// | ||
// class MockCanvas { | ||
// getContext() { | ||
// return { | ||
// drawImage: () => {}, | ||
// beginPath: () => {}, | ||
// lineTo: () => {}, | ||
// stroke: () => {}, | ||
// }; | ||
// } | ||
// | ||
// pngStream() { | ||
// return { | ||
// on: (event, cb) => { | ||
// if (event === 'end') { | ||
// setTimeout(cb, 1000); | ||
// } else if (event === `data`) { | ||
// /* eslint-disable */ | ||
// cb(`test`); | ||
// cb(`foo`); | ||
// cb(`bar`); | ||
// /* eslint-enable */ | ||
// } | ||
// }, | ||
// }; | ||
// } | ||
// } | ||
// | ||
// MockCanvas.Image = class Image {}; | ||
// | ||
// const faceDetectionExample = require(`../faceDetection`); | ||
// const inputFile = path.join(__dirname, `../resources`, `face.png`); | ||
// const outputFile = path.join(__dirname, `../../vision`, `out.png`); | ||
// | ||
// describe(`face detection`, () => { | ||
// before(tools.checkCredentials); | ||
// before(tools.stubConsole); | ||
// | ||
// after(tools.restoreConsole); | ||
// | ||
// it(`should detect faces`, async () => { | ||
// let done = false; | ||
// const timeout = setTimeout(() => { | ||
// if (!done) { | ||
// console.warn('Face detection timed out!'); | ||
// } | ||
// }, 60); | ||
// | ||
// faceDetectionExample.main( | ||
// inputFile, | ||
// outputFile, | ||
// MockCanvas, | ||
// (err, faces) => { | ||
// assert.ifError(err); | ||
// assert.strictEqual(faces.length, 1); | ||
// | ||
// const image = fs.readFileSync(outputFile); | ||
// assert.strictEqual(image.toString(`utf8`), `testfoobar`); | ||
// assert.ok(console.log.calledWith(`Found 1 face`)); | ||
// assert.ok(console.log.calledWith(`Highlighting...`)); | ||
// assert.ok(console.log.calledWith(`Finished!`)); | ||
// done = true; | ||
// clearTimeout(timeout); | ||
// } | ||
// ); | ||
// }); | ||
// }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
Sorry, something went wrong.