Skip to content
This repository was archived by the owner on Jul 20, 2023. It is now read-only.

Commit 5460a85

Browse files
fix: ignore case in system test assertions (#314)
1 parent 767cff5 commit 5460a85

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

samples/resources/google.png

5.83 KB
Loading

samples/system-test/detect.test.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ const files = [
3939
`city.jpg`,
4040
'pdf-ocr.pdf',
4141
'duck_and_truck.jpg',
42+
'google.png',
4243
].map(name => {
4344
return {
4445
name,
@@ -114,17 +115,17 @@ describe(`detect`, () => {
114115
});
115116

116117
it(`should detect logos in a local file`, async () => {
117-
const output = await exec(`${cmd} logos ${files[2].localPath}`);
118+
const output = await exec(`${cmd} logos ${files[9].localPath}`);
118119
assert.match(output, /Logos:/);
119-
assert.match(output, /Google/);
120+
assert.match(output, /google/);
120121
});
121122

122123
it(`should detect logos in a remote file`, async () => {
123124
const output = await exec(
124-
`${cmd} logos-gcs ${bucketName} ${files[2].name}`
125+
`${cmd} logos-gcs ${bucketName} ${files[9].name}`
125126
);
126127
assert.match(output, /Logos:/);
127-
assert.match(output, /Google/);
128+
assert.match(output, /google/);
128129
});
129130

130131
it(`should detect properties in a local file`, async () => {

system-test/vision.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,22 +66,31 @@ describe('Vision', function() {
6666
'https://upload.wikimedia.org/wikipedia/commons/5/51/Google.png';
6767
return client.logoDetection(url).then(responses => {
6868
const response = responses[0];
69-
assert.deepStrictEqual(response.logoAnnotations[0].description, 'Google');
69+
assert.strictEqual(
70+
response.logoAnnotations[0].description.toLowerCase(),
71+
'google'
72+
);
7073
});
7174
});
7275

7376
it('should detect from a filename', () => {
7477
return client.logoDetection(IMAGES.logo).then(responses => {
7578
const response = responses[0];
76-
assert.deepStrictEqual(response.logoAnnotations[0].description, 'Google');
79+
assert.deepStrictEqual(
80+
response.logoAnnotations[0].description.toLowerCase(),
81+
'google'
82+
);
7783
});
7884
});
7985

8086
it('should detect from a Buffer', () => {
8187
const buffer = fs.readFileSync(IMAGES.logo);
8288
return client.logoDetection(buffer).then(responses => {
8389
const response = responses[0];
84-
assert.deepStrictEqual(response.logoAnnotations[0].description, 'Google');
90+
assert.deepStrictEqual(
91+
response.logoAnnotations[0].description.toLowerCase(),
92+
'google'
93+
);
8594
});
8695
});
8796

0 commit comments

Comments
 (0)