-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request: Mocking types for unit test #239
Comments
@Rvice I don't have any plans for unit testing here. I have tried setting up testing in NetSuite a couple of times (using https://www.npmjs.com/package/@oracle/suitecloud-unit-testing and https://github.com/KyleJonesWinsted/suitecloud-unit-testing-stubs) but haven't ever had any luck with it actually being useful. Happy to take a look though if anybody has any ideas for improvement here! |
I've tried to set it up too, on the last 3 major projects. Had to abandon
it. I'll help out if we can get a baseline going
|
I'm close to a baseline with TeamCity, finally got the output working properly and using two tsconfig.ts to separate tests from production code (two different source/output dirs). That way it does not pollute NS with the test code. Issue I'm running into is the mocks with trying to rewrite the example from @oracle/suitecloud-unit-testing in typescript. Based on what I'm seeing, I see the "stubs" that are in the @oracle/suitecloud-unit-testing, just getting a failure when trying to use those directly on the record.load mock operation. |
Happy to help in anyway I can.
I know the value, so I'm willing to burn personal time.
|
I attempted to "convert" the example from @oracle/suitecloud-unit-testing, but it crashes at record.load.mockReturnValue I assume this is because my tsconfig is pointing 'N/**' to the HITC defines instead of the suitecloud-unit-testing, but trying to make the swap also doesn't seem to work. |
NFT has unit testing - maybe take a look at what's going on there. |
I've been able to get unit testing working pretty well by providing my own type declarations for @oracle/suitecloud-unit-testing package. It's mostly just lots of declarations like this:
Of course you may want to play around with that module name and your tsconfig path settings/jest moduleNameMapper, but the basic idea should be sound. I don't know if it would make sense to add something like that to this project, but maybe a separate project that uses this one to provide type declarations for @oracle/suitecloud-unit-testing would be useful. |
I agree, mocking would make more sense as a separate repo - keep this one focused on what it does best. |
Not sure if this is the right place, but it would be nice to get some mock support for unit testing. Is there any plan of this or a recommendation other than writing all the mocks out for jest?
The text was updated successfully, but these errors were encountered: