serpapi / google-search-results-nodejs

SerpApi client library for Node.js. Previously: Google Search Results Node.js.
https://serpapi.com
MIT License
78 stars 22 forks source link

`test/LocationApiSpec.js` test failure: `google_id` changed from 200635 to 1026201 #22

Open medero opened 3 months ago

medero commented 3 months ago

To replicate

npm install
export API_KEY=(key)
npm test

  21 passing (1s)
  1 failing

  1) Location API
       example:
     Uncaught Error: expect(received).toEqual(expected) // deep equality

Expected: 200635
Received: 1026201

Location API 1) example

I actually experienced this when refactoring PHP so switched to nodejs to sanity check the expected number and I think the 'Austin' search here changed due to possible updates?

const expect = require('expect'); const serpapi = require('../lib/main');

describe('Location API', () => {
  it('example', (done) => {
    var search = new serpapi.GoogleSearch()
    search.location("Austin", 3, (data) => {
      //console.log(data)
      expect(data[0].google_id).toEqual(200635)
      expect(data.length).toEqual(3)
      done()
    })
  })
})
ilyazub commented 3 months ago

@kagermanov27 Can you double-check whether this Location API test failure is related to our recent locations update?

kagermanov27 commented 2 months ago

@medero We have made an update to our Locations API and it is now more recent. You can refer to:

2024-06-19 CSV

for the latest update. Google has updated the Google ID (Criteria ID) for Austin,Texas,United States with 1026201.

ilyazub commented 2 months ago

@kagermanov27 Our test/LocationApiSpec.js is failing because of the Locations API update. I guess that was the issue.